Skip to content

Commit fd6ec91

Browse files
committed
use normpath to be more accurate when matching depots
1 parent 5041cd3 commit fd6ec91

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

base/loading.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,20 +3123,15 @@ mutable struct CacheHeaderIncludes
31233123
end
31243124

31253125
function replace_depot_path(path::AbstractString)
3126-
@static if Sys.iswindows()
3127-
path = replace(path, Filesystem.path_separator_re=>Filesystem.pathsep())
3128-
end
3126+
path = normpath(path)
31293127
for depot in DEPOT_PATH
31303128
!isdir(depot) && continue
31313129

31323130
# Strip extraneous pathseps through normalization.
31333131
if isdirpath(depot)
31343132
depot = dirname(depot)
31353133
end
3136-
3137-
@static if Sys.iswindows()
3138-
depot = replace(depot, Filesystem.path_separator_re=>Filesystem.pathsep())
3139-
end
3134+
depot = normpath(depot)
31403135

31413136
if startswith(path, string(depot, Filesystem.pathsep())) || path == depot
31423137
path = replace(path, depot => "@depot"; count=1)

test/relocatedepot.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,6 @@ if !test_relocated_depot
7070
@test Base.replace_depot_path(jlrc) != "@depot-rc2"
7171
@test Base.replace_depot_path(jlrc) == jlrc
7272
end
73-
if Sys.iswindows()
74-
# windows accepts '\\' and '/' as path separators
75-
mktempdir() do dir
76-
jlrc = string(dir, "/", "julia-rc2")
77-
jl = string(dir, "/", "julia")
78-
mkdir(jl)
79-
push!(DEPOT_PATH, jl)
80-
@test Base.replace_depot_path(jl) == "@depot"
81-
@test Base.replace_depot_path(string(jl,"/")) == string("@depot","\\")
82-
@test Base.replace_depot_path(string(jl,"\\")) == string("@depot","\\")
83-
@test Base.replace_depot_path(jlrc) != "@depot-rc2"
84-
@test Base.replace_depot_path(jlrc) ==
85-
replace(jlrc, Base.Filesystem.path_separator_re=>"\\")
86-
end
87-
end
8873
end
8974

9075
end

0 commit comments

Comments
 (0)