diff options
author | rabite <rabite@posteo.de> | 2019-02-07 20:47:53 +0100 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-02-07 20:47:53 +0100 |
commit | 8566086d0421a0baa6908c6418ba96d3a1d7f5db (patch) | |
tree | c5b532425b2e468cd37661308fe13d95b8387047 /src | |
parent | ea9d6d4d92a620a52efec96cd3310ecd690e7c40 (diff) |
don't show crap for directory size
Diffstat (limited to 'src')
-rw-r--r-- | src/files.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/files.rs b/src/files.rs index 6cb3611..4bd0f45 100644 --- a/src/files.rs +++ b/src/files.rs @@ -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 { |