From 05c1c8b0699d5ac8a85a844332d6b6ae0dff0c89 Mon Sep 17 00:00:00 2001 From: Ryan Hartlage Date: Mon, 18 Apr 2016 19:39:09 -0400 Subject: Add support for the --tree argument to the path command --- src/luarocks/cfg.lua | 12 +++++++++--- src/luarocks/path_cmd.lua | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 0099ec3a..f01fd205 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -666,17 +666,23 @@ function cfg.make_paths_from_tree(tree) return lua_path, lib_path, bin_path end -function cfg.package_paths() +function cfg.package_paths(current) local new_path, new_cpath, new_bin = {}, {}, {} - for _,tree in ipairs(cfg.rocks_trees) do + local function add_tree_to_paths(tree) local lua_path, lib_path, bin_path = cfg.make_paths_from_tree(tree) table.insert(new_path, lua_path.."/?.lua") table.insert(new_path, lua_path.."/?/init.lua") table.insert(new_cpath, lib_path.."/?."..cfg.lib_extension) table.insert(new_bin, bin_path) end + if current then + add_tree_to_paths(current) + end + for _,tree in ipairs(cfg.rocks_trees) do + add_tree_to_paths(tree) + end if extra_luarocks_module_dir then - table.insert(new_path, extra_luarocks_module_dir) + table.insert(new_path, extra_luarocks_module_dir) end return table.concat(new_path, ";"), table.concat(new_cpath, ";"), table.concat(new_bin, cfg.export_path_separator) end diff --git a/src/luarocks/path_cmd.lua b/src/luarocks/path_cmd.lua index 2bee4cb5..ecd6d4b1 100644 --- a/src/luarocks/path_cmd.lua +++ b/src/luarocks/path_cmd.lua @@ -37,7 +37,7 @@ function path_cmd.run(...) local flags = util.parse_flags(...) local deps_mode = deps.get_deps_mode(flags) - local lr_path, lr_cpath, lr_bin = cfg.package_paths() + local lr_path, lr_cpath, lr_bin = cfg.package_paths(flags["tree"]) local path_sep = cfg.export_path_separator if flags["lr-path"] then -- cgit v1.2.3-55-g6feb