Run format, introduce new function.

strip_end_slash_including_root will remove end slashes including the
root directory.

The root directory has been a long running problem because if we strip
the final slash we will run dust on no directory instead of the root.
This commit is contained in:
andy.boot
2019-10-02 20:14:13 +01:00
parent 9fbfcb275a
commit ec2d9e19d4
2 changed files with 31 additions and 14 deletions
+8
View File
@@ -64,6 +64,14 @@ pub fn strip_end_slash(s: &str) -> String {
new_name
}
pub fn strip_end_slash_including_root(s: &str) -> String {
let mut new_name = String::from(s);
while new_name.ends_with('/') || new_name.ends_with("/.") {
new_name.pop();
}
new_name
}
fn examine_dir(
top_dir: &str,
apparent_size: bool,