aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/cfg.lua2
-rw-r--r--src/luarocks/path_cmd.lua9
-rw-r--r--src/luarocks/util.lua1
3 files changed, 7 insertions, 5 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index a96d610f..05d58a10 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -544,7 +544,7 @@ function cfg.package_paths()
544 if extra_luarocks_module_dir then 544 if extra_luarocks_module_dir then
545 table.insert(new_path, extra_luarocks_module_dir) 545 table.insert(new_path, extra_luarocks_module_dir)
546 end 546 end
547 return table.concat(new_path, ";"), table.concat(new_cpath, ";"), table.concat(new_bin, ";") 547 return table.concat(new_path, ";"), table.concat(new_cpath, ";"), table.concat(new_bin, cfg.export_path_separator)
548end 548end
549 549
550function cfg.which_config() 550function cfg.which_config()
diff --git a/src/luarocks/path_cmd.lua b/src/luarocks/path_cmd.lua
index 4aeba41c..95532f9f 100644
--- a/src/luarocks/path_cmd.lua
+++ b/src/luarocks/path_cmd.lua
@@ -39,6 +39,7 @@ function path_cmd.run(...)
39 local deps_mode = deps.get_deps_mode(flags) 39 local deps_mode = deps.get_deps_mode(flags)
40 40
41 local lr_path, lr_cpath, lr_bin = cfg.package_paths() 41 local lr_path, lr_cpath, lr_bin = cfg.package_paths()
42 local path_sep = cfg.export_path_separator
42 43
43 if flags["lr-path"] then 44 if flags["lr-path"] then
44 util.printout(util.remove_path_dupes(lr_path, ';')) 45 util.printout(util.remove_path_dupes(lr_path, ';'))
@@ -47,24 +48,24 @@ function path_cmd.run(...)
47 util.printout(util.remove_path_dupes(lr_cpath, ';')) 48 util.printout(util.remove_path_dupes(lr_cpath, ';'))
48 return true 49 return true
49 elseif flags["lr-bin"] then 50 elseif flags["lr-bin"] then
50 util.printout(util.remove_path_dupes(lr_bin, ';')) 51 util.printout(util.remove_path_dupes(lr_bin, path_sep))
51 return true 52 return true
52 end 53 end
53 54
54 if flags["append"] then 55 if flags["append"] then
55 lr_path = package.path .. ";" .. lr_path 56 lr_path = package.path .. ";" .. lr_path
56 lr_cpath = package.cpath .. ";" .. lr_cpath 57 lr_cpath = package.cpath .. ";" .. lr_cpath
57 lr_bin = os.getenv("PATH") .. ";" .. lr_bin 58 lr_bin = os.getenv("PATH") .. path_sep .. lr_bin
58 else 59 else
59 lr_path = lr_path.. ";" .. package.path 60 lr_path = lr_path.. ";" .. package.path
60 lr_cpath = lr_cpath .. ";" .. package.cpath 61 lr_cpath = lr_cpath .. ";" .. package.cpath
61 lr_bin = lr_bin .. ";" .. os.getenv("PATH") 62 lr_bin = lr_bin .. path_sep .. os.getenv("PATH")
62 end 63 end
63 64
64 util.printout(cfg.export_lua_path:format(util.remove_path_dupes(lr_path, ';'))) 65 util.printout(cfg.export_lua_path:format(util.remove_path_dupes(lr_path, ';')))
65 util.printout(cfg.export_lua_cpath:format(util.remove_path_dupes(lr_cpath, ';'))) 66 util.printout(cfg.export_lua_cpath:format(util.remove_path_dupes(lr_cpath, ';')))
66 if flags["bin"] then 67 if flags["bin"] then
67 util.printout(cfg.export_path:format(util.remove_path_dupes(lr_bin,';'))) 68 util.printout(cfg.export_path:format(util.remove_path_dupes(lr_bin, path_sep)))
68 end 69 end
69 return true 70 return true
70end 71end
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index a70e726d..1bf6533b 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -432,6 +432,7 @@ function util.remove_path_dupes(list, sep)
432 local parts = util.split_string(list, sep) 432 local parts = util.split_string(list, sep)
433 local final, entries = {}, {} 433 local final, entries = {}, {}
434 for _, part in ipairs(parts) do 434 for _, part in ipairs(parts) do
435 part = part:gsub("//", "/")
435 if not entries[part] then 436 if not entries[part] then
436 table.insert(final, part) 437 table.insert(final, part)
437 entries[part] = true 438 entries[part] = true