Skip to content
Back to skills

Gum File Paths

ASecurity

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.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 7, 2026
design

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add vchelaru/Gum --skill gum-file-paths --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gum File Paths?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gum File Paths
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vchelaru-gum-file-paths/badge)](https://www.skillsdirectory.com/skills/vchelaru-gum-file-paths)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: gum-file-paths
description: 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.
---

# 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 `FilePath`s 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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in design →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.