From 2713445ad0a0449f3d9dc94c34d5a5005f24fb7f Mon Sep 17 00:00:00 2001 From: "andy.boot" Date: Thu, 18 Aug 2022 16:30:21 +0100 Subject: [PATCH] Fix: Permissions Stop incorrect reporting of "Did not have permissions" this would happen where dust is called with a file instead of a directory. https://github.com/bootandy/dust/issues/241 todo: add test --- src/dir_walker.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dir_walker.rs b/src/dir_walker.rs index 49899ec..f3b7345 100644 --- a/src/dir_walker.rs +++ b/src/dir_walker.rs @@ -170,7 +170,10 @@ fn walk( }) .collect(); } else { - permissions_flag.store(true, atomic::Ordering::Relaxed); + // Handle edge case where dust is called with a file instead of a directory + if !dir.exists() { + permissions_flag.store(true, atomic::Ordering::Relaxed); + } } build_node( dir,