mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
+6
-6
@@ -56,11 +56,13 @@ fn examine_dir(
|
|||||||
match (file_type, maybe_size_and_inode) {
|
match (file_type, maybe_size_and_inode) {
|
||||||
(Some(file_type), Some((size, inode))) => {
|
(Some(file_type), Some((size, inode))) => {
|
||||||
let s = d.path().to_string_lossy().to_string();
|
let s = d.path().to_string_lossy().to_string();
|
||||||
if let Some(inode_dev_pair) = inode {
|
if !apparent_size {
|
||||||
if inodes.contains(&inode_dev_pair) {
|
if let Some(inode_dev_pair) = inode {
|
||||||
continue;
|
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() {
|
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) {
|
fn human_readable_number(size: u64) -> (String) {
|
||||||
let units = vec!["T", "G", "M", "K"]; //make static
|
let units = vec!["T", "G", "M", "K"]; //make static
|
||||||
|
|
||||||
//return format!("{}B", size);
|
|
||||||
|
|
||||||
for (i, u) in units.iter().enumerate() {
|
for (i, u) in units.iter().enumerate() {
|
||||||
let marker = 1024u64.pow((units.len() - i) as u32);
|
let marker = 1024u64.pow((units.len() - i) as u32);
|
||||||
if size >= marker {
|
if size >= marker {
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
use std;
|
use std;
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
|
fn get_block_size() -> u64 {
|
||||||
pub fn get_block_size() -> u64 {
|
// All os specific implementations of MetatdataExt seem to define a block as 512 bytes
|
||||||
1024
|
// https://doc.rust-lang.org/std/os/linux/fs/trait.MetadataExt.html#tymethod.st_blocks
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
|
||||||
pub fn get_block_size() -> u64 {
|
|
||||||
512
|
512
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user