Fixed bug 3262 - Premake scripts are not compatible with "Genie" (premake fork)

jfverdon

Genie (https://github.com/bkaradzic/genie) is a well known premake fork which uses internally Lua 5.3 (as opposed to version 5.1 used in premake4).
As there is some Lua's API breaks in Lua 5.2, SDL premake scripts do not works with premake.

The two incompatibilities I noticed were:
* unhandle modes "rt" and "wt" for io.open. Has io.open opens files in text mode by default, the "t" flag is not needed (this flag is not supported in Genie).
* os.execute signature change, the return value is a tuple from Lua 5.2, before it was just the called program exit code.
This commit is contained in:
Sam Lantinga 2016-10-01 12:56:28 -07:00
parent 13f3fd56de
commit 6b80bece96
3 changed files with 20 additions and 8 deletions

View file

@ -33,8 +33,8 @@ local insertLocation
-- This function begins config header generation given the name of the generated
-- file and the name of the template file to use.
function startGeneration(file, template)
configFile = fileopen(file, "wt")
templateFileContents = readfile(template, "rt")
configFile = fileopen(file, "w")
templateFileContents = readfile(template, "r")
insertLocation = templateFileContents:find(searchKey)
if insertLocation then
configFile:write(templateFileContents:sub(1, insertLocation - 1))