Browse Source

Recursively check paths, not only the parent of files

master
Julio Biason 5 years ago
parent
commit
2cb09e431e
  1. 2
      Cargo.lock
  2. 6
      src/main.rs

2
Cargo.lock generated

@ -1,3 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "aho-corasick"
version = "0.7.6"

6
src/main.rs

@ -60,7 +60,11 @@ fn main() {
if filename.ends_with("/") {
files_dirs.insert(filename.clone());
} else {
directory_files.insert(Path::new(filename).parent().unwrap().to_str().unwrap().to_string() + "/");
let mut path = Path::new(filename);
while path.parent().is_some() {
directory_files.insert(path.parent().unwrap().to_str().unwrap().to_string() + "/");
path = path.parent().unwrap();
}
}
});
}

Loading…
Cancel
Save