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 361a5bd
Showing 1 changed file with 16 additions and 13 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

0 comments on commit 361a5bd

Please sign in to comment.