diff options
author | Canop <cano.petrole@gmail.com> | 2019-01-22 17:16:05 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2019-01-22 17:16:05 +0100 |
commit | b0c3e939b867f5cc07adde268cadf63606d211cc (patch) | |
tree | b115c29dbfdc8a37ac28006d9b74a36b4ab252ac /src/file_sizes.rs | |
parent | 2153ee1afb0b8d6e0eb2eed3040e9788122789bd (diff) |
more precise display of file/dir sizes
Diffstat (limited to 'src/file_sizes.rs')
-rw-r--r-- | src/file_sizes.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/file_sizes.rs b/src/file_sizes.rs index 2d3f777..030dfa0 100644 --- a/src/file_sizes.rs +++ b/src/file_sizes.rs @@ -12,7 +12,7 @@ use std::path::{Path, PathBuf}; use std::sync::Mutex; use std::time::Instant; -const SIZE_NAMES: &[&str] = &["", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; // YB: for when your disk is bigger than 1024 ZB +const SIZE_NAMES: &[&str] = &["", "K", "M", "G", "T", "P", "E", "Z", "Y"]; // Y: for when your disk is bigger than 1024 ZB #[derive(Debug, Copy, Clone)] pub struct Size(u64); @@ -79,7 +79,7 @@ impl Size { pub fn to_string(&self) -> String { let mut v = self.0; let mut i = 0; - while v >= 1024 && i < SIZE_NAMES.len() - 1 { + while v >= 9000 && i < SIZE_NAMES.len() - 1 { v >>= 10; i += 1; } |