From 60e536fdb410694ece41ce5ac8517ffc4826391c Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Wed, 25 Nov 2015 00:09:17 +0100 Subject: fix: bad errormessage and missing quotes --- src/luarocks/cfg.lua | 4 +++- src/luarocks/fs/lua.lua | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index e3d6e74b..a22cf121 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -663,7 +663,7 @@ function cfg.init_package_paths() end function cfg.which_config() - return { + local ret = { system = { file = sys_config_file or sys_config_file_default, ok = sys_config_ok, @@ -673,6 +673,8 @@ function cfg.which_config() ok = home_config_ok, } } + ret.nearest = (ret.user.ok and ret.user.file) or ret.system.file + return ret end cfg.user_agent = "LuaRocks/"..cfg.program_version.." "..cfg.arch diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 73ae2698..18e6b01a 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua @@ -134,10 +134,10 @@ function fs_lua.is_tool_available(tool_cmd, tool_name, arg) arg = arg or "--version" assert(type(arg) == "string") - if not fs.execute_quiet(tool_cmd, arg) then + if not fs.execute_quiet(fs.Q(tool_cmd), arg) then local msg = "'%s' program not found. Make sure %s is installed and is available in your PATH " .. - "(or you may want to edit the 'variables.%s' value in file 'config.lua')" - return nil, msg:format(tool_cmd, tool_name, tool_cmd:upper()) + "(or you may want to edit the 'variables.%s' value in file '%s')" + return nil, msg:format(tool_cmd, tool_name, tool_name:upper(), cfg.which_config().nearest) else return true end -- cgit v1.2.3-55-g6feb