mirror of https://github.com/bobwen-dev/hunter
don't show crap for directory size
This commit is contained in:
parent
ea9d6d4d92
commit
8566086d04
|
@ -273,6 +273,14 @@ impl File {
|
|||
}
|
||||
|
||||
pub fn calculate_size(&self) -> (usize, String) {
|
||||
if self.is_dir() {
|
||||
let dir_iterator = std::fs::read_dir(&self.path);
|
||||
match dir_iterator {
|
||||
Ok(dir_iterator) => return (dir_iterator.count(), "".to_string()),
|
||||
Err(_) => return (0, "".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
let mut unit = 0;
|
||||
let mut size = self.size.unwrap();
|
||||
while size > 1024 {
|
||||
|
|
Loading…
Reference in New Issue