Skip to content

Commit

Permalink
absolutify --project and JULIA_PROJECT paths
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Aug 13, 2018
1 parent d7e4584 commit 0131a55
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ function init_load_path()
end
project = (JLOptions().project != C_NULL ?
unsafe_string(Base.JLOptions().project) :
get(ENV, "JULIA_PROJECT", nothing))
get(ENV, "JULIA_PROJECT", ""))
HOME_PROJECT[] =
project == "" ? nothing :
project == "@." ? current_project() : project
project == "@." ? current_project() : abspath(project)
append!(empty!(LOAD_PATH), paths)
end

Expand Down
17 changes: 17 additions & 0 deletions test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,23 @@ finally
popfirst!(LOAD_PATH)
end

@testset "absolute project paths" begin
# --project and JULIA_PROJECT paths should be absolute
mktempdir() do dir; cd(dir) do
mkdir("foo")
script = """
using Test
old = Base.active_project()
cd("foo")
@test Base.active_project() == old
"""
@test success(`$(Base.julia_cmd()) --project=foo -e $(script)`)
withenv("JULIA_PROJECT" => "foo") do
@test success(`$(Base.julia_cmd()) -e $(script)`)
end
end; end
end

## cleanup after tests ##

for env in keys(envs)
Expand Down

0 comments on commit 0131a55

Please sign in to comment.