Open kimikage opened 2 weeks ago
Or, (on Julia v1.11 and later)
function Base.isfile_casesensitive(path)
Base.isaccessiblefile(path) || return false # Fail fast
name = basename(path)
try
for entry in Base.Filesystem._readdirx(dirname(path), sort = false)
entry.name == name && return true
end
catch err
isa(err, Base.IOError) || rethrow()
end
return false
end
An internal function
isfile_casesensitive()
uses Win32APIGetLongPathNameW
on Windows. https://github.com/JuliaLang/julia/blob/222231f047462bcb2cef3e402c86cf41df82414d/base/loading.jl#L11-L16However, the API may not be able to handle non-existent directories.
This problem can also be reproduced on Julia v1.6.7. Perhaps `normpath()' would mitigate this problem.
Incidentally, parent directories of non-existent directories seem to be invalid on Linux from the beginning.