Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows double-adjustment of PATH #20

Merged
merged 5 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JLLWrappers"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
authors = ["Mosè Giordano", "Elliot Saba"]
version = "1.1.1"
version = "1.1.2"

[compat]
julia = "1.0.0"
Expand Down
20 changes: 13 additions & 7 deletions src/runtime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ else
end

function adjust_ENV!(env::Dict, PATH::String, LIBPATH::String, adjust_PATH::Bool, adjust_LIBPATH::Bool)
if adjust_PATH
if !isempty(get(env, "PATH", ""))
env["PATH"] = string(PATH, pathsep, env["PATH"])
else
env["PATH"] = PATH
end
end
if adjust_LIBPATH
LIBPATH_base = get(env, LIBPATH_env, expanduser(LIBPATH_default))
if !isempty(LIBPATH_base)
Expand All @@ -29,6 +22,15 @@ function adjust_ENV!(env::Dict, PATH::String, LIBPATH::String, adjust_PATH::Bool
env[LIBPATH_env] = LIBPATH
end
end
if adjust_PATH && (LIBPATH_env != "PATH" || !adjust_LIBPATH)
if adjust_PATH
if !isempty(get(env, "PATH", ""))
env["PATH"] = string(PATH, pathsep, env["PATH"])
else
env["PATH"] = PATH
end
end
end
return env
end

Expand Down Expand Up @@ -83,6 +85,10 @@ Return the library paths that e.g. libjulia and such are stored in.
function get_julia_libpaths()
if isempty(JULIA_LIBDIRS)
append!(JULIA_LIBDIRS, [joinpath(Sys.BINDIR, Base.LIBDIR, "julia"), joinpath(Sys.BINDIR, Base.LIBDIR)])
# Windows needs to see the BINDIR as well
@static if Sys.iswindows()
push!(JULIA_LIBDIRS, Sys.BINDIR)
end
end
return JULIA_LIBDIRS
end
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,10 @@ module TestJLL end
@test isdir(@eval TestJLL OpenLibm_jll.artifact_dir)
@test isempty(@eval TestJLL OpenLibm_jll.PATH[])
@test occursin(Sys.BINDIR, @eval TestJLL OpenLibm_jll.LIBPATH[])

# Issue #20
if Sys.iswindows()
@test Sys.BINDIR ∈ JLLWrappers.get_julia_libpaths()
end
end
end