Skip to main content

normal_path

Function normal_path 

Source
pub fn normal_path(text: &str) -> String
Expand description

The normal text of the path text names: text split on /, without its empty and . components and keeping every .., joined by / after a / when text starts with one; ., or / when absolute, when no component is left. Every text names a path, so this never fails.

assert_eq!(flow_types::normal_path("a//b/./c/"), "a/b/c");
assert_eq!(flow_types::normal_path("/../x"), "/../x");
assert_eq!(flow_types::normal_path(""), ".");