Function normalize

Source
pub fn normalize(path: &str) -> String
Expand description

The path.normalize() method normalizes the given path, resolving ‘..’ and ‘.’ segments.

When multiple, sequential path segment separation characters are found (e.g. / on POSIX and either \ or / on Windows), they are replaced by a single instance of the platform-specific path segment /// separator (/ on POSIX and \ on Windows). Trailing separators are preserved.

If the path is a zero-length string, ‘.’ is returned, representing the current working directory.

assert_eq!(nodejs_path::posix::normalize("/foo/bar//baz/asdf/quux/.."), "/foo/bar/baz/asdf");