aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/command_line.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua
index d16ef8e2..63b918b5 100644
--- a/src/luarocks/command_line.lua
+++ b/src/luarocks/command_line.lua
@@ -98,9 +98,22 @@ function run_command(...)
98 if flags["tree"] == true or flags["tree"] == "" then 98 if flags["tree"] == true or flags["tree"] == "" then
99 die("Argument error: use --tree=<path>") 99 die("Argument error: use --tree=<path>")
100 end 100 end
101 local fs = require("luarocks.fs") 101 local named = false
102 local root_dir = fs.absolute_name(flags["tree"]) 102 for _, tree in ipairs(cfg.rocks_trees) do
103 path.use_tree(root_dir) 103 if type(tree) == "table" and flags["tree"] == tree.name then
104 if not tree.root then
105 die("Configuration error: tree '"..tree.name.."' has no 'root' field.")
106 end
107 path.use_tree(dir.normalize(tree.root))
108 named = true
109 break
110 end
111 end
112 if not named then
113 local fs = require("luarocks.fs")
114 local root_dir = fs.absolute_name(flags["tree"])
115 path.use_tree(root_dir)
116 end
104 elseif flags["local"] then 117 elseif flags["local"] then
105 path.use_tree(cfg.home_tree) 118 path.use_tree(cfg.home_tree)
106 else 119 else