Build: Fix command line arguments being ignored if config.lua loading failed

Former-commit-id: a0b9389550d838dbb1257ad68f190f1191bf1987 [formerly 6888f45b376814ff8cea69054c87110b0842bae4]
Former-commit-id: 13522b14991d0e08341798d29344b6e5d6f0a9bd
This commit is contained in:
Lynix 2016-07-31 11:01:07 +02:00
parent 70ee053f3f
commit b2351e6ef2
1 changed files with 16 additions and 19 deletions

View File

@ -637,26 +637,23 @@ end
function NazaraBuild:LoadConfig()
local f = io.open("config.lua", "r")
if (not f) then
if (f) then
local content = f:read("*a")
f:close()
local func, err = loadstring(content)
if (func) then
setfenv(func, self.Config)
local status, err = pcall(func)
if (not status) then
print("Failed to load config.lua: " .. err)
end
else
print("Failed to parse config.lua: " .. err)
end
else
print("Failed to open config.lua")
return
end
local content = f:read("*a")
f:close()
local func, err = loadstring(content)
if (not func) then
print("Failed to parse config.lua: " .. err)
return
end
setfenv(func, self.Config)
local status, err = pcall(func)
if (not status) then
print("Failed to load config.lua: " .. err)
return
end
local configTable = self.Config