normalize_lexically

Function normalize_lexically 

Source
pub fn normalize_lexically(path: &Path) -> Result<PathBuf, NormalizeError>
Expand description

Copied from stdlib where it’s unstable.

Normalize a path, including .. without traversing the filesystem.

Returns an error if normalization would leave leading .. components.

This function always resolves .. to the “lexical” parent. That is “a/b/../c” will always resolve to a/c which can change the meaning of the path. In particular, a/c and a/b/../c are distinct on many systems because b may be a symbolic link, so its parent isn’t a.

path::absolute is an alternative that preserves ... Or Path::canonicalize can be used to resolve any .. by querying the filesystem.