nu_path::dots

Function expand_dots

Source
pub fn expand_dots(path: impl AsRef<Path>) -> PathBuf
Expand description

Normalize the path, expanding occurrences of “.” and “..”.

It performs the same normalization as nu_path::components(), except it also expands “..” when its preceding component is a normal component, ignoring the possibility of symlinks. In other words, it operates on the lexical structure of the path.

This won’t expand “/..” even though the parent directory of “/” is often considered to be itself.

The resulting path will use platform-specific path separators, regardless of what path separators was used in the input.