Function path_clean::clean
source · pub fn clean<P>(path: P) -> PathBufwhere
P: AsRef<Path>,
Expand description
The core implementation. It performs the following, lexically:
- Reduce multiple slashes to a single slash.
- Eliminate
.
path name elements (the current directory). - Eliminate
..
path name elements (the parent directory) and the non-.
non-..
, element that precedes them. - Eliminate
..
elements that begin a rooted path, that is, replace/..
by/
at the beginning of a path. - Leave intact
..
elements that begin a non-rooted path.
If the result of this process is an empty string, return the string "."
, representing the current directory.