agentleFS
vchelaruvchelaru/Gum/.claude/skills/gum-file-paths/SKILL.md

gum-file-paths

Skill659 starsChanged 2 months agoMITView on GitHub

ToolsUtilities.FilePath comparison and normalization semantics, plus cross-platform file-move traps. Triggers: FilePath, Standardized, FullPath, comparing a computed path to one from Directory.EnumerateFiles, case-only renames.

The file

Files
SKILL.md

Gum File Path Semantics

ToolsUtilities.FilePath is the repo's path type. Each difference below from raw-string behavior fails silently — wrong result, no exception.

== is case-insensitive; FullPath is case-preserving

FilePath equality compares Standardized, which is lowercased. FullPath keeps the original casing. Any logic about a case-only rename (Foo → foo) must compare FullPath ordinally — oldPath == newPath reports "nothing changed" for exactly the rename it needs to detect.

Standardized is for comparison only

FilePath.Standardized and StandardizedNoPathNoExtension are lowercased, so opening or reading a file through them misses on a case-sensitive file system (Linux, some macOS volumes). Do I/O through FullPath, and compare FilePaths with ==. Tool projects ban both properties via BannedSymbols.CrossPlatform.txt (RS0030).

Standardized normalizes to Path.DirectorySeparatorChar, not /

FileManager.RemoveDotDotSlash does the conversion. A hardcoded Contains("/bin/") check therefore matches on Unix and is dead on Windows. This bites production code, not just test assertions.

Saved paths use backslashes

Project files saved on Windows store relative paths with \, which is a legal file-name character on macOS and Linux. Convert every saved path through FilePath or FileManager.Standardize before disk I/O, and check existence with FileManager.FileExists, not File.Exists. Content loads (FileManager.GetStreamForFile) ask FileManager.CustomGetStreamFromFile first, then fall back to disk.

., .. and doubled separators are collapsed

FileManager.RemoveDotDotSlash (and so FilePath and the content loaders' cache keys; Standardize calls it only for a path containing ..) collapses every ., .. and empty segment and keeps the leading separators, so dir/./a.png, dir//a.png and dir/a.png are one key. A leading ./ is kept: on mobile it marks an already-resolved path (#4548). To decide whether two spellings are one file, run both through FilePath.StandardizedCaseSensitive, and fold case only where the file system ignores it (Windows, macOS, iOS), never via Standardized (see above); AnimationFrame.GetTextureIdentity is the example.

Paths built without RemoveDotDotSlash still keep a .: a CodeProjectRoot of "./" yields C:\Proj\.\Screens\X.cs, which never compares equal to what Directory.EnumerateFiles returns. Code diffing computed paths against enumerated ones must run both sides through Path.GetFullPath first. CodeGenerationFileLocationsService output is the usual source of the computed side.

File.Move on a case-only rename is platform-divergent

Windows handles it directly; .NET pre-checks the destination on Unix and throws "already exists" on a case-insensitive macOS volume. Move through a temp name in two steps. A single-step move passes on Windows and fails only on the macOS CI leg, so a local run does not prove it.

Related

  • gum-unit-tests — writing path assertions that hold on both Windows and Unix CI legs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.