1
0
mirror of https://github.com/bobwen-dev/hunter synced 2025-04-12 00:55:41 +02:00

don't show crap for directory size

This commit is contained in:
rabite 2019-02-07 20:47:53 +01:00
parent ea9d6d4d92
commit 8566086d04

View File

@ -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 {