Skip to content

Commit

Permalink
When using a custom depot, still look in bundled directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Sep 25, 2023
1 parent 13d3efb commit 1284d6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
29 changes: 16 additions & 13 deletions base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ See also [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH), and
"""
const DEPOT_PATH = String[]

function append_default_depot_path!(DEPOT_PATH)
path = joinpath(homedir(), ".julia")
path in DEPOT_PATH || push!(DEPOT_PATH, path)
function append_bundled_depot_path!(DEPOT_PATH)
path = abspath(Sys.BINDIR, "..", "local", "share", "julia")
path in DEPOT_PATH || push!(DEPOT_PATH, path)
path = abspath(Sys.BINDIR, "..", "share", "julia")
Expand All @@ -98,21 +96,26 @@ end

function init_depot_path()
empty!(DEPOT_PATH)
populated = false

if haskey(ENV, "JULIA_DEPOT_PATH")
str = ENV["JULIA_DEPOT_PATH"]
isempty(str) && return
for path in eachsplit(str, Sys.iswindows() ? ';' : ':')
if isempty(path)
append_default_depot_path!(DEPOT_PATH)
else
path = expanduser(path)
path in DEPOT_PATH || push!(DEPOT_PATH, path)
end
isempty(path) && continue
path = expanduser(path)
path in DEPOT_PATH || push!(DEPOT_PATH, path)
populated = true
end
else
append_default_depot_path!(DEPOT_PATH)
end
nothing

if !populated
path = joinpath(homedir(), ".julia")
push!(DEPOT_PATH, path)
end

append_bundled_depot_path!(DEPOT_PATH)

return
end

## LOAD_PATH & ACTIVE_PROJECT ##
Expand Down
2 changes: 1 addition & 1 deletion test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ end
@testset "expansion of JULIA_DEPOT_PATH" begin
s = Sys.iswindows() ? ';' : ':'
tmp = "/this/does/not/exist"
DEFAULT = Base.append_default_depot_path!(String[])
DEFAULT = Base.append_bundled_depot_path!(String[])
cases = Dict{Any,Vector{String}}(
nothing => DEFAULT,
"" => [],
Expand Down

0 comments on commit 1284d6f

Please sign in to comment.