Skip to content

Commit

Permalink
Remove incorrect return in load_path_expand (#30224)
Browse files Browse the repository at this point in the history
This fixes a problem where Julia does not find
and active project when the ~/.julia/environments/v#.#
folder exist but does not contain a Project.toml file.
  • Loading branch information
fredrikekre authored Dec 3, 2018
1 parent 7614cec commit 71748da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ function load_path_expand(env::AbstractString)::Union{String, Nothing}
file = abspath(path, proj)
isfile_casesensitive(file) && return file
end
return path
end
isempty(DEPOT_PATH) && return nothing
return abspath(DEPOT_PATH[1], "environments", name, project_names[end])
Expand Down
15 changes: 15 additions & 0 deletions test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,21 @@ end
end; end
end

# Base.active_project when version directory exist in depot, but contains no project file
mktempdir() do dir
vdir = Base.DEFAULT_LOAD_PATH[2]
vdir = replace(vdir, "#" => VERSION.major, count = 1)
vdir = replace(vdir, "#" => VERSION.minor, count = 1)
vdir = replace(vdir, "#" => VERSION.patch, count = 1)
vdir = vdir[2:end] # remove @
vpath = joinpath(dir, "environments", vdir)
mkpath(vpath)
withenv("JULIA_DEPOT_PATH" => dir) do
script = "@assert startswith(Base.active_project(), $(repr(vpath)))"
@test success(`$(Base.julia_cmd()) -e $(script)`)
end
end

## cleanup after tests ##

for env in keys(envs)
Expand Down

0 comments on commit 71748da

Please sign in to comment.