Skip to main content

normalize_path

Function normalize_path 

Source
pub fn normalize_path(path: &Path) -> PathBuf
Expand description

Collapse . and .. components lexically, without touching the filesystem. Needed for prefix comparisons: starts_with is purely lexical, so a path like /home/u/.config/../dotfiles/warp does not start with /home/u/dotfiles even though they resolve to the same place.

Unlike std::fs::canonicalize, this does NOT follow symlinks — callers that want lexical normalization of a symlink target joined against its parent path get the right answer without an extra round through the OS.