diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2014-05-28 15:30:23 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-05-28 15:30:23 -0300 |
| commit | 4ab6969557d25d2d7d422d2829f9d604f21fbae8 (patch) | |
| tree | b4f8017c30994e6c8684c48c9bb5901ff938209f /src | |
| parent | f8c6ac159aedb0a9aa72337f4bb5bd7a5dbcc15b (diff) | |
| download | luarocks-4ab6969557d25d2d7d422d2829f9d604f21fbae8.tar.gz luarocks-4ab6969557d25d2d7d422d2829f9d604f21fbae8.tar.bz2 luarocks-4ab6969557d25d2d7d422d2829f9d604f21fbae8.zip | |
Dehardcode the separator for PATH variables, fixing behavior on Unix.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/cfg.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/path_cmd.lua | 9 | ||||
| -rw-r--r-- | src/luarocks/util.lua | 1 |
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) |
| 548 | end | 548 | end |
| 549 | 549 | ||
| 550 | function cfg.which_config() | 550 | function 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 |
| 70 | end | 71 | end |
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 |
