aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/cmd.lua13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua
index 284b1602..cb669226 100644
--- a/src/luarocks/cmd.lua
+++ b/src/luarocks/cmd.lua
@@ -157,18 +157,15 @@ local function get_lua_version(flags)
157 return flags["lua-version"] 157 return flags["lua-version"]
158 end 158 end
159 local dirs = {} 159 local dirs = {}
160 local next_i = 1
161 if flags["project-tree"] then 160 if flags["project-tree"] then
162 dirs[next_i] = dir.path(flags["project-tree"], "..", ".luarocks") 161 table.insert(dirs, dir.path(flags["project-tree"], "..", ".luarocks"))
163 next_i = next_i + 1
164 end 162 end
165 if cfg.home_tree then 163 if cfg.home_tree then
166 dirs[next_i] = dir.path(cfg.home_tree, ".luarocks") 164 table.insert(dirs, dir.path(cfg.home_tree, ".luarocks"))
167 next_i = next_i + 1
168 end 165 end
169 dirs[next_i] = cfg.sysconfdir 166 table.insert(dirs, cfg.sysconfdir)
170 for i=1, next_i do 167 for _, d in ipairs(dirs) do
171 local f = dir.path(dirs[i], "default-lua-version.lua") 168 local f = dir.path(d, "default-lua-version.lua")
172 local mod, err = loadfile(f, "t") 169 local mod, err = loadfile(f, "t")
173 if mod then 170 if mod then
174 local pok, ver = pcall(mod) 171 local pok, ver = pcall(mod)