From 356d14ac0fcb65959369eab9fb7f5c1503a2f872 Mon Sep 17 00:00:00 2001 From: "andy.boot" Date: Mon, 23 Dec 2019 15:51:12 +0000 Subject: [PATCH] Hack fix around JWalk behaviour. Jwalk returns '/' as a child of the current node which breaks things. https://github.com/jessegrosjean/jwalk/issues/13 --- src/utils/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/mod.rs b/src/utils/mod.rs index a404c25..0d337ea 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -125,6 +125,11 @@ fn examine_dir( } // This path and all its parent paths have their counter incremented for path_name in e.path().ancestors() { + // This is required due to bug in Jwalk that adds '/' to all sub dir lists + // see: https://github.com/jessegrosjean/jwalk/issues/13 + if path_name.to_string_lossy() == "/" && top_dir != "/" { + continue + } let path_name = path_name.to_string_lossy(); let s = data.entry(path_name.to_string()).or_insert(0); *s += size;