summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2020-07-22 08:41:13 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-07-22 08:41:13 +0800
commit22a13fbea06199151d5cdf2f3a0533984111e0b3 (patch)
tree9c754fa97b02b4e5cb5f98971dda6b8d850fa49d
parent16e00de6821675f8c4a0ed8500c2abfaa3af3bb0 (diff)
Use full path for obtaining the 'real size on disk'
This fixes a long standing issue on windows, #53, which relies on the full path to be used. On linux, it seems to be enough to use the meta-data, which is also passed along. On windows, the path seems to actually be used, explaining why it wonderously didn't work on windows before.
-rw-r--r--src/traverse.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/traverse.rs b/src/traverse.rs
index 0b56aa8..a19630d 100644
--- a/src/traverse.rs
+++ b/src/traverse.rs
@@ -95,7 +95,7 @@ impl Traversal {
} else {
entry.file_name.into()
};
- let file_size = match entry.client_state {
+ let file_size = match &entry.client_state {
Some(Ok(ref m))
if !m.is_dir()
&& (walk_options.count_hard_links || inodes.add(m))
@@ -105,11 +105,15 @@ impl Traversal {
if walk_options.apparent_size {
m.len()
} else {
- data.name.size_on_disk_fast(m).unwrap_or_else(|_| {
- t.io_errors += 1;
- data.metadata_io_error = true;
- 0
- })
+ entry
+ .parent_path
+ .join(&data.name)
+ .size_on_disk_fast(m)
+ .unwrap_or_else(|_| {
+ t.io_errors += 1;
+ data.metadata_io_error = true;
+ 0
+ })
}
}
Some(Ok(_)) => 0,