mirror of https://github.com/bjornbytes/lovr.git
Shift arguments up by one in fused mode;
There's a bug where arguments start at 0 instead of 1 in fused mode. In fused mode, we aren't going to consume one of the command line arguments for the project path like we normally do, so in order to provide that argument to the lovr project at index 1, shift them all up by one in boot.lua. We can only do this after the filesystem module is loaded, so it can't go in main.c with all the other arg stuff. The zero'th argument in fused mode is now the source path, just like how it works in non-fused mode. This means the executable path is in the arg table twice, which is sensible since in fused mode both the interpreter and the interpreter's source are the same file.
This commit is contained in:
parent
d70619ec96
commit
72c93630ce
|
@ -146,6 +146,14 @@ function lovr.boot()
|
|||
local hasConf, hasMain = lovr.filesystem.isFile('conf.lua'), lovr.filesystem.isFile('main.lua')
|
||||
if not lovr.filesystem.getSource() or not (hasConf or hasMain) then nogame() end
|
||||
|
||||
-- Shift args up in fused mode, instead of consuming one for the source path
|
||||
if lovr.filesystem.isFused() then
|
||||
for i = 1, #arg + 1 do
|
||||
arg[i] = arg[i - 1]
|
||||
end
|
||||
arg[0] = lovr.filesystem.getSource()
|
||||
end
|
||||
|
||||
local confOk, confError = true
|
||||
if hasConf then confOk, confError = pcall(require, 'conf') end
|
||||
if confOk and lovr.conf then confOk, confError = pcall(lovr.conf, conf) end
|
||||
|
|
Loading…
Reference in New Issue