From ff2981a586c5ec3cb6fc1925f5d58e38302d1fed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Thu, 3 Jun 2010 20:02:31 +0200
Subject: Always generate DefaultThemeQRC if the default thheme changed.


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",
-- 
cgit v0.10.2-6-g49f6