mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user