Skip to main content

normalize_path_lexically

Function normalize_path_lexically 

Source
fn normalize_path_lexically(p: &Path) -> String
Expand description

Lexically normalizes a path with NO filesystem access (unlike canonicalize, safe to call on a path that doesn’t exist). Collapses . and .. components (codex P1, PR #2802: without this, a not-yet- created dir like $HOME/.claude/. compared unequal to $HOME/.claude under plain string comparison, bypassing the guard entirely on a fresh machine — a .. segment is normalized the same way for the same reason). Never pops past a root/prefix/leading .. — a leading .. with nothing to cancel stays literal, standard lexical-normalization semantics.