Merge script error handling fix in module loader

This commit is contained in:
Jason Perkins 2015-03-13 16:49:22 -04:00
commit 4667789bc3

View File

@ -77,15 +77,22 @@
dir = base
end
local function tryLoad(filename)
local chunk, err = loadfile(filename)
if not chunk and not err:startswith("No such file") then
error(err, 0)
end
return chunk
end
-- Premake standard is moduleName/moduleName.lua
local relPath = dir .. "/" .. base .. ".lua"
local chunk = loadfile("modules/" .. relPath)
local chunk = tryLoad("modules/" .. relPath)
if not chunk then
chunk = loadfile(relPath)
chunk = tryLoad(relPath)
end
if not chunk then
chunk = loadfile(name .. ".lua")
chunk = tryLoad(name .. ".lua")
end
if not chunk then