-
-
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
Make require case-sensitive on all platforms #13542
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,23 @@ abspath(a::AbstractString, b::AbstractString...) = abspath(joinpath(a,b...)) | |
end | ||
end | ||
|
||
@windows_only longpath(path::AbstractString) = longpath(utf16(path)) | ||
@windows_only function longpath(path::UTF16String) | ||
buf = Array(UInt16, length(path.data)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya, but maybe it should be a separate PR just for organizational reasons. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay. |
||
while true | ||
p = ccall((:GetLongPathNameW, "Kernel32"), stdcall, UInt32, | ||
(Cwstring, Ptr{UInt16}, UInt32), | ||
path, buf, length(buf)) | ||
systemerror(:longpath, p == 0) | ||
# Buffer wasn't big enough, in which case `p` is the necessary buffer size | ||
if (p > length(buf)) | ||
resize!(buf, p) | ||
continue | ||
end | ||
return utf8(UTF16String(buf)) | ||
end | ||
end | ||
|
||
@unix_only function realpath(path::AbstractString) | ||
p = ccall(:realpath, Ptr{UInt8}, (Cstring, Ptr{UInt8}), path, C_NULL) | ||
systemerror(:realpath, p == C_NULL) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,18 @@ thefname = "the fname!//\\&\0\1*" | |
@test include_string("Base.source_path()", thefname) == Base.source_path() | ||
@test basename(@__FILE__) == "loading.jl" | ||
@test isabspath(@__FILE__) | ||
|
||
# Issue #5789 and PR #13542: | ||
let true_filename = "cAsEtEsT.jl", lowered_filename="casetest.jl" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a comment here: # Issue #5789 and PR #13542: |
||
touch(true_filename) | ||
@test Base.isfile_casesensitive(true_filename) | ||
@test !Base.isfile_casesensitive(lowered_filename) | ||
rm(true_filename) | ||
end | ||
|
||
# Test Unicode normalization; pertinent for OS X | ||
let nfc_name = "\U00F4.jl" | ||
touch(nfc_name) | ||
@test Base.isfile_casesensitive(nfc_name) | ||
rm(nfc_name) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly this should be
basename(longpath(path)) == basename(path)
? Two reasons:import Foo
would check forFoo
in a case-sensitive way. But this does more than that, and checks the whole path. This means that usersLOAD_PATH
andHOME
variables becomes case-sensitive, for example, which is unexpected on case-insensitive systems, and has led to at least one confused user on discourse.