diff options
author | Thomas Hurst <tom@hur.st> | 2020-03-23 18:31:38 +0000 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-24 06:25:41 +0800 |
commit | cf902dbc2cc7b80b2657cf2429db708cc71b6253 (patch) | |
tree | 307449036662f7fd93adad75d1c02fc4b430ddea /src/traverse.rs | |
parent | 45d1ef31181cd9b430d855a4fe23550ea97e685e (diff) |
Update to filesize v0.2
Diffstat (limited to 'src/traverse.rs')
-rw-r--r-- | src/traverse.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/traverse.rs b/src/traverse.rs index 064fcd4..4b73147 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -1,14 +1,15 @@ use crate::{get_size_or_panic, InodeFilter, WalkOptions}; use failure::Error; +use filesize::PathExt; use petgraph::{graph::NodeIndex, stable_graph::StableGraph, Directed, Direction}; -use std::{ffi::OsString, path::PathBuf, time::Duration, time::Instant}; +use std::{path::PathBuf, time::Duration, time::Instant}; pub type TreeIndex = NodeIndex; pub type Tree = StableGraph<EntryData, (), Directed>; #[derive(Eq, PartialEq, Debug, Default, Clone)] pub struct EntryData { - pub name: OsString, + pub name: PathBuf, /// The entry's size in bytes. If it's a directory, the size is the aggregated file size of all children pub size: u64, /// If set, the item meta-data could not be obtained @@ -91,7 +92,7 @@ impl Traversal { data.name = if entry.depth < 1 { path.clone().into() } else { - entry.file_name + entry.file_name.into() }; let file_size = match entry.client_state { Some(Ok(ref m)) @@ -101,7 +102,7 @@ impl Traversal { if walk_options.apparent_size { m.len() } else { - filesize::file_real_size_fast(&data.name, m).unwrap_or_else( + data.name.size_on_disk_fast(m).unwrap_or_else( |_| { t.io_errors += 1; data.metadata_io_error = true; |