aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/cfg.lua4
-rw-r--r--src/luarocks/persist.lua8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 70c16a2a..ba8c7f22 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -149,11 +149,11 @@ sys_config_file = site_config.LUAROCKS_SYSCONFIG or sys_config_dir.."/config-"..
149local err, errcode 149local err, errcode
150sys_config_ok, err, errcode = persist.load_into_table(sys_config_file, cfg) 150sys_config_ok, err, errcode = persist.load_into_table(sys_config_file, cfg)
151 151
152if (not sys_config_ok) and errcode ~= "run" then 152if (not sys_config_ok) and errcode == "open" then -- file not found, so try alternate file
153 sys_config_file = sys_config_dir.."/config.lua" 153 sys_config_file = sys_config_dir.."/config.lua"
154 sys_config_ok, err, errcode = persist.load_into_table(sys_config_file, cfg) 154 sys_config_ok, err, errcode = persist.load_into_table(sys_config_file, cfg)
155end 155end
156if (not sys_config_ok) and errcode ~= "open" then 156if (not sys_config_ok) and errcode ~= "open" then -- either "load" or "run"; bad config file, bail out with error
157 io.stderr:write(err.."\n") 157 io.stderr:write(err.."\n")
158 os.exit(cfg.errorcodes.CONFIGFILE) 158 os.exit(cfg.errorcodes.CONFIGFILE)
159end 159end
diff --git a/src/luarocks/persist.lua b/src/luarocks/persist.lua
index 04440670..ba3789d1 100644
--- a/src/luarocks/persist.lua
+++ b/src/luarocks/persist.lua
@@ -53,10 +53,10 @@ end
53-- @param filename string: the name of the file. 53-- @param filename string: the name of the file.
54-- @param tbl table or nil: if given, this table is used to store 54-- @param tbl table or nil: if given, this table is used to store
55-- loaded values. 55-- loaded values.
56-- @return (table, table) or (nil, string, string): a table with the file's 56-- @return table or (nil, string, string): a table with the file's assignments
57-- assignments as fields and set of undefined globals accessed in file, 57-- as fields, or nil, an error message and an error code ("open"; couldn't open the file,
58-- or nil, an error message and an error code ("open", "load" or "run") in 58-- "load"; compile-time error, or "run"; run-time error)
59-- case of errors. 59-- in case of errors.
60function persist.load_into_table(filename, tbl) 60function persist.load_into_table(filename, tbl)
61 assert(type(filename) == "string") 61 assert(type(filename) == "string")
62 assert(type(tbl) == "table" or not tbl) 62 assert(type(tbl) == "table" or not tbl)