From e935ae52e744968c1ed9c1984a1f9c76cea83f55 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Thu, 3 Dec 2009 11:29:33 +0000 Subject: [PATCH] mostly cosmetic changes for the new romfs compress/compile feature --- SConstruct | 5 +++++ mkfs.py | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index c26831d6..67734160 100644 --- a/SConstruct +++ b/SConstruct @@ -234,6 +234,11 @@ if romfsmode not in ['verbatim', 'compile', 'compress']: # Build the compilation command now compcmd = '' if romfsmode == 'compile': + # First check for luac.cross in the current directory + if not os.path.isfile( "luac.cross" ): + print "The eLua cross compiler was not found." + print "Build it by running 'scons -f cross-lua.py'" + sys.exit( -1 ) compcmd = './luac.cross -ccn %s -cce %s -o %%s -s %%s' % ( toolset[ 'cross_%s' % target ], toolset[ 'cross_cpumode' ] ) elif romfsmode == 'compress': compcmd = 'lua luasrcdiet.lua --quiet --maximum --opt-comments --opt-whitespace --opt-emptylines --opt-eols --opt-strings --opt-numbers --opt-locals -o %s %s' diff --git a/mkfs.py b/mkfs.py index 4c42fd72..15731929 100644 --- a/mkfs.py +++ b/mkfs.py @@ -75,12 +75,13 @@ def mkfs( dirname, outname, flist, mode, compcmd ): return False # Do we need to process the file? + fextpart = '' if mode == "compile" or mode == "compress": fnamepart, fextpart = os.path.splitext( realname ) if mode == "compress": newext = ".lua.tmp" else: - newext = ".luac" + newext = ".lc" if fextpart == ".lua": newname = fnamepart + newext if mode == "compress": @@ -102,9 +103,8 @@ def mkfs( dirname, outname, flist, mode, compcmd ): fname = fnamepart + ".lc" filedata = crtfile.read() crtfile.close() - if mode == 'compile' or mode == "compress": - if fextpart == ".lua": - os.remove( newname ) + if fextpart == ".lua" and mode != "verbatim": + os.remove( newname ) # Write name, size, id, numpars for c in fname: