19
19
--
20
20
21
21
-- imports
22
+ imports (" core.base.hashset" )
22
23
import (" core.package.package" , {alias = " core_package" })
23
24
24
25
-- 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
26
30
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
28
32
for _ , value in ipairs (values ) do
29
33
if path .is_absolute (value ) then
30
34
os .addenv (name , value )
31
35
else
32
- os .addenv (name , path .join (installdir , value ))
36
+ os .addenv (name , path .normalize ( path . join (installdir , value ) ))
33
37
end
34
38
end
35
39
else
@@ -45,7 +49,7 @@ function enter(...)
45
49
for _ , manifest_file in ipairs (os .files (path .join (core_package .installdir (), name :sub (1 , 1 ), name , " *" , " *" , " manifest.txt" ))) do
46
50
local manifest = io .load (manifest_file )
47
51
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 ))
49
53
end
50
54
end
51
55
end
0 commit comments