Mercurial > LightClone
comparison LightTools/Build.py @ 0:7e3a0ae9c016
Initial commit
author | koryspansel <koryspansel@bendbroadband.com> |
---|---|
date | Wed, 07 Sep 2011 12:36:37 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7e3a0ae9c016 |
---|---|
1 # | |
2 # Build | |
3 # | |
4 | |
5 import Map | |
6 import os | |
7 import sys | |
8 | |
9 if __name__ == '__main__': | |
10 path_root = os.path.dirname(sys.argv[0]) | |
11 path_assets = os.path.abspath(os.path.join(path_root, '..', 'Assets', 'Maps')) | |
12 path_build = os.path.abspath(os.path.join(path_root, '..', 'Data', 'Maps')) | |
13 | |
14 if os.path.isdir(path_assets): | |
15 for filename in os.listdir(path_assets): | |
16 if not filename.endswith('.def'): | |
17 continue | |
18 | |
19 definition = Map.ReadDefinition(os.path.join(path_assets, filename)) | |
20 if not definition: | |
21 continue | |
22 | |
23 output = os.path.join(path_build, os.path.splitext(filename)[0] + '.map') | |
24 folder = os.path.dirname(output) | |
25 | |
26 if not os.path.isdir(folder): | |
27 os.makedirs(folder) | |
28 | |
29 print 'Building %s from %s' % (os.path.basename(output), os.path.basename(filename)) | |
30 definition.Write(output) |