diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2015-10-24 23:22:39 -0400 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-10-24 23:22:39 -0400 |
commit | bc3ac2174e0404b13afee9114bd38e4f3bfb476b (patch) | |
tree | 58600f1ff178632fa8211e34517ff898bde704c9 /src | |
parent | 552090caad52c0c00013d9286a58f1311e7b29f3 (diff) | |
download | luarocks-bc3ac2174e0404b13afee9114bd38e4f3bfb476b.tar.gz luarocks-bc3ac2174e0404b13afee9114bd38e4f3bfb476b.tar.bz2 luarocks-bc3ac2174e0404b13afee9114bd38e4f3bfb476b.zip |
If LUAROCKS_CONFIGURE is given and is invalid, do not silently switch to a default path.
Fail instead (and report that when the user checks the configuration.)
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cfg.lua | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index a4f60f55..ec9a9829 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -228,17 +228,26 @@ end | |||
228 | if not site_config.LUAROCKS_FORCE_CONFIG then | 228 | if not site_config.LUAROCKS_FORCE_CONFIG then |
229 | 229 | ||
230 | home_config_file_default = home_config_dir.."/config-"..cfg.lua_version..".lua" | 230 | home_config_file_default = home_config_dir.."/config-"..cfg.lua_version..".lua" |
231 | local list = { | ||
232 | os.getenv("LUAROCKS_CONFIG_" .. version_suffix) or os.getenv("LUAROCKS_CONFIG"), | ||
233 | home_config_file_default, | ||
234 | home_config_dir.."/config.lua", | ||
235 | } | ||
236 | -- first entry might be a silent nil, check and remove if so | ||
237 | if not list[1] then table.remove(list, 1) end | ||
238 | |||
239 | home_config_file = load_config_file(list) | ||
240 | home_config_ok = (home_config_file ~= nil) | ||
241 | 231 | ||
232 | local config_env_var = "LUAROCKS_CONFIG_" .. version_suffix | ||
233 | local config_env_value = os.getenv(config_env_var) | ||
234 | if not config_env_value then | ||
235 | config_env_var = "LUAROCKS_CONFIG" | ||
236 | config_env_value = os.getenv(config_env_var) | ||
237 | end | ||
238 | if config_env_value then | ||
239 | home_config_ok = load_config_file({ config_env_value }) | ||
240 | if not home_config_ok then | ||
241 | io.stderr:write("Warning: could not load file "..config_env_value.." given in environment variable "..config_env_var) | ||
242 | end | ||
243 | home_config_file = config_env_var | ||
244 | else | ||
245 | home_config_file = load_config_file({ | ||
246 | home_config_file_default, | ||
247 | home_config_dir.."/config.lua", | ||
248 | }) | ||
249 | home_config_ok = (home_config_file ~= nil) | ||
250 | end | ||
242 | end | 251 | end |
243 | 252 | ||
244 | 253 | ||