diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 0e7cdd7..b8dc156 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -56,11 +56,13 @@ fn examine_dir( match (file_type, maybe_size_and_inode) { (Some(file_type), Some((size, inode))) => { let s = d.path().to_string_lossy().to_string(); - if let Some(inode_dev_pair) = inode { - if inodes.contains(&inode_dev_pair) { - continue; + if !apparent_size { + if let Some(inode_dev_pair) = inode { + if inodes.contains(&inode_dev_pair) { + continue; + } + inodes.insert(inode_dev_pair); } - inodes.insert(inode_dev_pair); } if d.path().is_dir() && !file_type.is_symlink() { @@ -209,8 +211,6 @@ fn print_this_node(node_to_print: &Node, is_biggest: bool, depth: u8, indentatio fn human_readable_number(size: u64) -> (String) { let units = vec!["T", "G", "M", "K"]; //make static - //return format!("{}B", size); - for (i, u) in units.iter().enumerate() { let marker = 1024u64.pow((units.len() - i) as u32); if size >= marker { diff --git a/src/utils/platform.rs b/src/utils/platform.rs index bf876f1..402d8ae 100644 --- a/src/utils/platform.rs +++ b/src/utils/platform.rs @@ -1,12 +1,8 @@ use std; -#[cfg(not(any(target_os = "macos", target_os = "linux")))] -pub fn get_block_size() -> u64 { - 1024 -} - -#[cfg(any(target_os = "macos", target_os = "linux"))] -pub fn get_block_size() -> u64 { +fn get_block_size() -> u64 { + // All os specific implementations of MetatdataExt seem to define a block as 512 bytes + // https://doc.rust-lang.org/std/os/linux/fs/trait.MetadataExt.html#tymethod.st_blocks 512 }