Skip to main content

normalize_path

Function normalize_path 

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

Collapse . / .. components without touching the filesystem. Used on Windows to give junction::create an absolute target when the caller computed a relative ../../foocanonicalize isn’t an option because it requires the target to already exist and strips the UNC prefix the junction API is happy to accept. Also exposed cross-platform so callers can resolve relative paths stored in POSIX shims without tripping over macOS’s /var/private/var symlink (canonicalize eagerly follows that symlink, which throws off the .. count in shim-embedded relative targets).