src/cleanpath_conservative.rs in faster_path-0.2.5 vs src/cleanpath_conservative.rs in faster_path-0.2.6
- old
+ new
@@ -9,11 +9,11 @@
pub fn cleanpath_conservative(path: &str) -> String {
let sep = MAIN_SEPARATOR.to_string();
let mut names: Vec<String> = vec![];
let mut pre = path.to_string();
loop {
- match chop_basename(&pre) {
+ match chop_basename(&pre.clone()) {
Some((ref p, ref base)) => {
pre = p.to_string();
match base.as_ref() {
"." => {},
_ => names.unshift(base.to_string()),
@@ -88,10 +88,10 @@
assert_eq!(cleanpath_conservative("a/./c"), "a/c");
assert_eq!(cleanpath_conservative("a/b/."), "a/b/.");
assert_eq!(cleanpath_conservative("a/../."), "a/..");
assert_eq!(cleanpath_conservative("/../.././../a"), "/a");
assert_eq!(cleanpath_conservative("a/b/../../../../c/../d"), "a/b/../../../../c/../d");
-;
+
// Future Windows Support
//
// DOSISH = File::ALT_SEPARATOR != nil
// DOSISH_DRIVE_LETTER = File.dirname("A:") == "A:."
// DOSISH_UNC = File.dirname("//") == "//"