From 78fe51af7ff6b877872feb6a671680c4f4ec716b Mon Sep 17 00:00:00 2001 From: Jake Ireland Date: Sun, 28 Aug 2022 17:37:31 +1200 Subject: [PATCH] Check for . and .. for UNIX Even though . and .. directories start with ., they should be excluded from being hidden Addresses #1 --- src/HiddenFiles.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/HiddenFiles.jl b/src/HiddenFiles.jl index 85f1f50..1c263ac 100644 --- a/src/HiddenFiles.jl +++ b/src/HiddenFiles.jl @@ -3,7 +3,12 @@ module HiddenFiles export ishidden @static if Sys.isunix() - _ishidden_unix(f::AbstractString) = startswith(basename(f), '.') + const DOT_EXCLUSIONS = (".", "..") + function _ishidden_unix(f::AbstractString) + _basename = basename(f) ∈ DOT_EXCLUSIONS + _basename ∈ DOT_EXCLUSIONS && return false + return startswith(basename(f), '.') + end @static if Sys.isapple() ### Hidden Files and Directories: Simplifying the User Experience ###