From 5aa2ad03018ef5553605e0d8860807b69330e3bc Mon Sep 17 00:00:00 2001 From: Jake Ireland Date: Tue, 30 Aug 2022 08:14:02 +1200 Subject: [PATCH] Throw error if path does not exist Addresses #9. This will hopefully avoid any problems that arise in any internal functions used. Note that further error handling should be implemented, as, for example, checking for package or bundle still seg faults when you give it the root directory. --- src/HiddenFiles.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/HiddenFiles.jl b/src/HiddenFiles.jl index 2f011c3..0d2e3d9 100644 --- a/src/HiddenFiles.jl +++ b/src/HiddenFiles.jl @@ -126,7 +126,10 @@ end # Each OS branch defines its own _ishidden function. In the main ishidden function, we check that the path exists, expand # the real path out, and apply the branch's _ishidden function to that path to get a final result -ishidden(f::AbstractString) = ispath(f) && _ishidden(realpath(f)) +function ishidden(f::AbstractString) + ispath(f) || throw(Base.uv_error("ishidden($(repr(f)))", Base.UV_ENOENT)) + return _ishidden(realpath(f)) +end end