diff LightTools/Build.py @ 0:7e3a0ae9c016

Initial commit
author koryspansel <koryspansel@bendbroadband.com>
date Wed, 07 Sep 2011 12:36:37 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LightTools/Build.py	Wed Sep 07 12:36:37 2011 -0700
@@ -0,0 +1,30 @@
+#
+# Build
+#
+
+import Map
+import os
+import sys
+
+if __name__ == '__main__':
+    path_root   = os.path.dirname(sys.argv[0])
+    path_assets = os.path.abspath(os.path.join(path_root, '..', 'Assets', 'Maps'))
+    path_build  = os.path.abspath(os.path.join(path_root, '..', 'Data', 'Maps'))
+
+    if os.path.isdir(path_assets):
+        for filename in os.listdir(path_assets):
+            if not filename.endswith('.def'):
+                continue
+
+            definition = Map.ReadDefinition(os.path.join(path_assets, filename))
+            if not definition:
+                continue
+
+            output = os.path.join(path_build, os.path.splitext(filename)[0] + '.map')
+            folder = os.path.dirname(output)
+
+            if not os.path.isdir(folder):
+                os.makedirs(folder)
+
+            print 'Building %s from %s' % (os.path.basename(output), os.path.basename(filename))
+            definition.Write(output)