aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-11-07 17:48:36 -0800
committerHisham Muhammad <hisham@gobolinux.org>2015-11-07 17:48:36 -0800
commitce3ea550e02da88cb3236309655ef890f32a0ed8 (patch)
treeeff2bdbc1f187d8e420a913286125b3b06715763 /src
parent9c99043149e7578fbbfedbbdc7950a3c1f61ba6e (diff)
parentcb3e2aff5c1665db48bdd274bd696a0d465cbd3a (diff)
downloadluarocks-ce3ea550e02da88cb3236309655ef890f32a0ed8.tar.gz
luarocks-ce3ea550e02da88cb3236309655ef890f32a0ed8.tar.bz2
luarocks-ce3ea550e02da88cb3236309655ef890f32a0ed8.zip
Merge pull request #413 from Tieske/unversion_LR
Win installer: Unversion LR target path
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cfg.lua36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 3b7f9c37..e3d6e74b 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -228,17 +228,33 @@ end
228if not site_config.LUAROCKS_FORCE_CONFIG then 228if 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 231
239 home_config_file = load_config_file(list) 232 local config_env_var = "LUAROCKS_CONFIG_" .. version_suffix
240 home_config_ok = (home_config_file ~= nil) 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
239 -- first try environment provided file, so we can explicitly warn when it is missing
240 if config_env_value then
241 local list = { config_env_value }
242 home_config_file = load_config_file(list)
243 home_config_ok = (home_config_file ~= nil)
244 if not home_config_ok then
245 io.stderr:write("Warning: could not load configuration file `"..config_env_value.."` given in environment variable "..config_env_var.."\n")
246 end
247 end
241 248
249 -- try the alternative defaults if there was no environment specified file or it didn't work
250 if not home_config_ok then
251 local list = {
252 home_config_file_default,
253 home_config_dir.."/config.lua",
254 }
255 home_config_file = load_config_file(list)
256 home_config_ok = (home_config_file ~= nil)
257 end
242end 258end
243 259
244 260
@@ -375,7 +391,7 @@ local defaults = {
375} 391}
376 392
377if cfg.platforms.windows then 393if cfg.platforms.windows then
378 local full_prefix = (site_config.LUAROCKS_PREFIX or (os.getenv("PROGRAMFILES")..[[\LuaRocks]])).."\\"..cfg.major_version 394 local full_prefix = (site_config.LUAROCKS_PREFIX or (os.getenv("PROGRAMFILES")..[[\LuaRocks]]))
379 extra_luarocks_module_dir = full_prefix.."\\lua\\?.lua" 395 extra_luarocks_module_dir = full_prefix.."\\lua\\?.lua"
380 396
381 home_config_file = home_config_file and home_config_file:gsub("\\","/") 397 home_config_file = home_config_file and home_config_file:gsub("\\","/")