-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@__DIR__ and @__FILE__ should use upercase drive letter on Windows #26000
Comments
Probably both should be done. When comparing drive letters I think that the drive comparison should be case insensitive since the underlying file system considers |
Related to #9436 (making |
I just tried to figure out how this could be fixed, but I think the string with that path is constructed somewhere in the non-Julia parts, as far as I can tell. Which means it is above my pay grade :) Having said that, it would be fantastic if this could be fixed, this is constantly tripping up code on Windows that is comparing paths... |
Hi, function cd(dir::AbstractString)
if Sys.iswindows()
m = match(r"[a-z]:", dir)
if typeof(m) != Nothing
dir = replace(dir, m.match => uppercase(m.match))
end
end
err = ccall(:uv_chdir, Cint, (Cstring,), dir)
err < 0 && uv_error("cd($(repr(dir)))", err)
return nothing
end |
It seems that this issue has been fixed? Current LTS version on Win 11: julia> versioninfo()
Julia Version 1.10.6
Commit 67dffc4a8a (2024-10-28 12:23 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13900HX
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
Threads: 1 default, 0 interactive, 1 GC (on 32 virtual cores)
julia> @info "Julia v$(VERSION):" (@__DIR__) (@__FILE__)
┌ Info: Julia v1.10.6:
│ #= REPL[2]:1 =# @__DIR__ = "T:\\jl-testall"
└ #= REPL[2]:1 =# @__FILE__ = "REPL[2]" Test across versions: test code # bugs.jl
@info "Julia v$(VERSION):" (@__DIR__) (@__FILE__) test script # test-all-versions.ps1
Set-PSDebug -Trace 1
julia +1.0 bugs.jl
julia +1.6 bugs.jl
julia +1.10.0 bugs.jl
julia +1.10 bugs.jl
julia +1.11.0 bugs.jl
julia +1.11 bugs.jl
julia +nightly bugs.jl Output:
|
Both macros currently seem to return paths that use lowercase drive letters, i.e. something like
c:\\bla\\bla
. Functions likehomedir()
andabspath
on the other hand return paths with uppercase drive letters. Things then break when one tries to mix paths returned from these macros with paths returned from things likehomedir
with therelpath
function because it is case-sensitive.I guess another option would be to make
relpath
on Windows case-insensitive. But it might be easier to just change the two macros?The text was updated successfully, but these errors were encountered: