Skip to content

Commit be0f7c3

Browse files
committed
fix pathenvs
1 parent 70f4e6c commit be0f7c3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

xmake/core/package/package.lua

+1
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ function _instance:manifest_save()
889889
manifest.mode = self:mode()
890890
manifest.configs = self:configs()
891891
manifest.envs = self:_rawenvs()
892+
manifest.pathenvs = self:_pathenvs():to_array()
892893

893894
-- save enabled library deps
894895
if self:librarydeps() then

xmake/modules/private/action/require/impl/packagenv.lua

+8-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,21 @@
1919
--
2020

2121
-- imports
22+
imports("core.base.hashset")
2223
import("core.package.package", {alias = "core_package"})
2324

2425
-- enter the package environments
25-
function _enter_package(package_name, envs, installdir)
26+
function _enter_package(package_name, envs, pathenvs, installdir)
27+
if pathenvs then
28+
pathenvs = hashset.from(pathenvs)
29+
end
2630
for name, values in pairs(envs) do
27-
if name == "PATH" or name == "LD_LIBRARY_PATH" or name == "DYLD_LIBRARY_PATH" then
31+
if pathenvs and pathenvs:has(name) then
2832
for _, value in ipairs(values) do
2933
if path.is_absolute(value) then
3034
os.addenv(name, value)
3135
else
32-
os.addenv(name, path.join(installdir, value))
36+
os.addenv(name, path.normalize(path.join(installdir, value)))
3337
end
3438
end
3539
else
@@ -45,7 +49,7 @@ function enter(...)
4549
for _, manifest_file in ipairs(os.files(path.join(core_package.installdir(), name:sub(1, 1), name, "*", "*", "manifest.txt"))) do
4650
local manifest = io.load(manifest_file)
4751
if manifest and manifest.plat == os.host() and manifest.arch == os.arch() then
48-
_enter_package(name, manifest.envs, path.directory(manifest_file))
52+
_enter_package(name, manifest.envs, manifest.pathenvs, path.directory(manifest_file))
4953
end
5054
end
5155
end

0 commit comments

Comments
 (0)