aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/cmd.lua26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua
index ea906726..d7201084 100644
--- a/src/luarocks/cmd.lua
+++ b/src/luarocks/cmd.lua
@@ -265,6 +265,19 @@ local function process_server_flags(flags)
265 return true 265 return true
266end 266end
267 267
268local function find_lua_version_at(dirname)
269 local lua_version
270 for v in util.lua_versions("descending") do
271 if exists(dir.path(dirname, ".luarocks", "config-"..v..".lua")) then
272 lua_version = v
273 break
274 end
275 end
276 return {
277 lua_version = lua_version
278 }
279end
280
268--- Main command-line processor. 281--- Main command-line processor.
269-- Parses input arguments and calls the appropriate driver function 282-- Parses input arguments and calls the appropriate driver function
270-- to execute the action requested on the command-line, forwarding 283-- to execute the action requested on the command-line, forwarding
@@ -395,16 +408,9 @@ function cmd.run_command(description, commands, external_namespace, ...)
395 die("Could not find a Lua interpreter for version " .. flags["lua-version"] .. " in your PATH") 408 die("Could not find a Lua interpreter for version " .. flags["lua-version"] .. " in your PATH")
396 end 409 end
397 elseif project_dir then 410 elseif project_dir then
398 local lua_version 411 lua_data = find_lua_version_at(project_dir)
399 for v in util.lua_versions("descending") do 412 else
400 if exists(dir.path(project_dir, ".luarocks", "config-"..v..".lua")) then 413 lua_data = find_lua_version_at(".")
401 lua_version = v
402 break
403 end
404 end
405 lua_data = {
406 lua_version = lua_version
407 }
408 end 414 end
409 415
410 -- FIXME A quick hack for the experimental Windows build 416 -- FIXME A quick hack for the experimental Windows build