Skip to content

Commit 141037f

Browse files
authored
Merge pull request #20 from JuliaPackaging/sf/dont_adjust_twice
Fix Windows double-adjustment of `PATH`
2 parents 422311e + 79da522 commit 141037f

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JLLWrappers"
22
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
33
authors = ["Mosè Giordano", "Elliot Saba"]
4-
version = "1.1.1"
4+
version = "1.1.2"
55

66
[compat]
77
julia = "1.0.0"

src/runtime.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ else
1414
end
1515

1616
function adjust_ENV!(env::Dict, PATH::String, LIBPATH::String, adjust_PATH::Bool, adjust_LIBPATH::Bool)
17-
if adjust_PATH
18-
if !isempty(get(env, "PATH", ""))
19-
env["PATH"] = string(PATH, pathsep, env["PATH"])
20-
else
21-
env["PATH"] = PATH
22-
end
23-
end
2417
if adjust_LIBPATH
2518
LIBPATH_base = get(env, LIBPATH_env, expanduser(LIBPATH_default))
2619
if !isempty(LIBPATH_base)
@@ -29,6 +22,15 @@ function adjust_ENV!(env::Dict, PATH::String, LIBPATH::String, adjust_PATH::Bool
2922
env[LIBPATH_env] = LIBPATH
3023
end
3124
end
25+
if adjust_PATH && (LIBPATH_env != "PATH" || !adjust_LIBPATH)
26+
if adjust_PATH
27+
if !isempty(get(env, "PATH", ""))
28+
env["PATH"] = string(PATH, pathsep, env["PATH"])
29+
else
30+
env["PATH"] = PATH
31+
end
32+
end
33+
end
3234
return env
3335
end
3436

@@ -83,6 +85,10 @@ Return the library paths that e.g. libjulia and such are stored in.
8385
function get_julia_libpaths()
8486
if isempty(JULIA_LIBDIRS)
8587
append!(JULIA_LIBDIRS, [joinpath(Sys.BINDIR, Base.LIBDIR, "julia"), joinpath(Sys.BINDIR, Base.LIBDIR)])
88+
# Windows needs to see the BINDIR as well
89+
@static if Sys.iswindows()
90+
push!(JULIA_LIBDIRS, Sys.BINDIR)
91+
end
8692
end
8793
return JULIA_LIBDIRS
8894
end

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,10 @@ module TestJLL end
4141
@test isdir(@eval TestJLL OpenLibm_jll.artifact_dir)
4242
@test isempty(@eval TestJLL OpenLibm_jll.PATH[])
4343
@test occursin(Sys.BINDIR, @eval TestJLL OpenLibm_jll.LIBPATH[])
44+
45+
# Issue #20
46+
if Sys.iswindows()
47+
@test Sys.BINDIR JLLWrappers.get_julia_libpaths()
48+
end
4449
end
4550
end

0 commit comments

Comments
 (0)