diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-24 14:04:37 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-31 11:16:09 -0300 |
commit | 9a67a7c047b6d743c8f9e534720b49c2fa25962b (patch) | |
tree | 8dccf709036e3d679d6d80e68812e2ed9f815652 | |
parent | aecf82e80e1a450857efe55c6dfe3be4354fab75 (diff) | |
download | luarocks-9a67a7c047b6d743c8f9e534720b49c2fa25962b.tar.gz luarocks-9a67a7c047b6d743c8f9e534720b49c2fa25962b.tar.bz2 luarocks-9a67a7c047b6d743c8f9e534720b49c2fa25962b.zip |
put project dir up front for module search paths, but enable it as default
-rw-r--r-- | src/luarocks/command_line.lua | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 27965212..a8977c24 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -143,15 +143,10 @@ function command_line.run_command(...) | |||
143 | end | 143 | end |
144 | 144 | ||
145 | if flags["project-tree"] then | 145 | if flags["project-tree"] then |
146 | table.insert(cfg.rocks_trees, 1, { name = "project", root = flags["project-tree"] } ) | 146 | local tree = flags["project-tree"] |
147 | else | 147 | table.insert(cfg.rocks_trees, 1, { name = "project", root = tree } ) |
148 | local project_dir, rocks_tree = find_project_dir() | 148 | path.use_tree(tree) |
149 | if project_dir then | 149 | elseif flags["tree"] then |
150 | table.insert(cfg.rocks_trees, 1, { name = "project", root = rocks_tree } ) | ||
151 | end | ||
152 | end | ||
153 | |||
154 | if flags["tree"] then | ||
155 | local named = false | 150 | local named = false |
156 | for _, tree in ipairs(cfg.rocks_trees) do | 151 | for _, tree in ipairs(cfg.rocks_trees) do |
157 | if type(tree) == "table" and flags["tree"] == tree.name then | 152 | if type(tree) == "table" and flags["tree"] == tree.name then |
@@ -175,8 +170,14 @@ function command_line.run_command(...) | |||
175 | end | 170 | end |
176 | replace_tree(flags, cfg.home_tree) | 171 | replace_tree(flags, cfg.home_tree) |
177 | else | 172 | else |
178 | local trees = cfg.rocks_trees | 173 | local project_dir, rocks_tree = find_project_dir() |
179 | path.use_tree(trees[#trees]) | 174 | if project_dir then |
175 | table.insert(cfg.rocks_trees, 1, { name = "project", root = rocks_tree } ) | ||
176 | path.use_tree(rocks_tree) | ||
177 | else | ||
178 | local trees = cfg.rocks_trees | ||
179 | path.use_tree(trees[#trees]) | ||
180 | end | ||
180 | end | 181 | end |
181 | 182 | ||
182 | if type(cfg.root_dir) == "string" then | 183 | if type(cfg.root_dir) == "string" then |