diff options
-rw-r--r-- | Swift/QtUI/SConscript | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index ffafcb8..8a58f5e 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -1,20 +1,21 @@ import os, shutil, datetime import Version -def generateDefaultTheme(env, target, source) : - sourceDir = source[0].abspath - output = open(target[0].abspath, "w") - output.write("<RCC version =\"1.0\">") - output.write("<qresource prefix=\"/themes/Default\">") +def generateDefaultTheme(dir) : + sourceDir = dir.abspath + result = "<!-- WARNING: This file is automatically generated. Any changes will be overwritten. -->\n" + result += "<RCC version =\"1.0\">" + result += "<qresource prefix=\"/themes/Default\">" for (path, dirs, files) in os.walk(sourceDir) : for file in files : filePath = os.path.join(path,file) - output.write("<file alias=\"%(alias)s\">%(path)s</file>" % { + result += "<file alias=\"%(alias)s\">%(path)s</file>" % { "alias": filePath[len(sourceDir)+1:], "path": filePath - }) - output.write("</qresource>") - output.write("</RCC>") + } + result += "</qresource>" + result += "</RCC>" + return result Import("env") @@ -46,7 +47,7 @@ if env["PLATFORM"] == "win32" : myenv.Append(LINKFLAGS = ["/SUBSYSTEM:WINDOWS"]) myenv.Append(LIBS = "qtmain") -myenv.Command("DefaultTheme.qrc", "../resources/themes/Default", Action(generateDefaultTheme, cmdstr = "$GENCOMSTR")) +myenv.WriteVal("DefaultTheme.qrc", myenv.Value(generateDefaultTheme(myenv.Dir("../resources/themes/Default")))) sources = [ "main.cpp", |