aboutsummaryrefslogtreecommitdiff
path: root/tools/file_packager.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-10-28 10:23:46 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-28 10:23:46 -0700
commitb5c2757c7c54b08b4cb5a0524a2b64c11eb7d65d (patch)
tree6f7765c3e79f15a142ca9eca858d4dcbdd85ca38 /tools/file_packager.py
parent432c9e5d8cf543dc998026a4923a5a7e7cdc6af6 (diff)
only emit decrunch code when crunch is enabled
Diffstat (limited to 'tools/file_packager.py')
-rw-r--r--tools/file_packager.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/tools/file_packager.py b/tools/file_packager.py
index a2349a57..30f216ae 100644
--- a/tools/file_packager.py
+++ b/tools/file_packager.py
@@ -338,18 +338,9 @@ if has_preloaded:
send: function() {},
onload: function() {
var byteArray = this.byteArray.subarray(this.start, this.end);
- if (this.crunched) {
- var ddsHeader = byteArray.subarray(0, 128);
- var that = this;
- requestDecrunch(this.name, byteArray.subarray(128), function(ddsData) {
- byteArray = new Uint8Array(ddsHeader.length + ddsData.length);
- byteArray.set(ddsHeader, 0);
- byteArray.set(ddsData, 128);
- that.finish(byteArray);
- });
- } else {
+%s
this.finish(byteArray);
- }
+%s
},
finish: function(byteArray) {
var that = this;
@@ -365,7 +356,20 @@ if has_preloaded:
this.requests[this.name] = null;
},
};
- '''
+ ''' % ('' if not crunch else '''
+ if (this.crunched) {
+ var ddsHeader = byteArray.subarray(0, 128);
+ var that = this;
+ requestDecrunch(this.name, byteArray.subarray(128), function(ddsData) {
+ byteArray = new Uint8Array(ddsHeader.length + ddsData.length);
+ byteArray.set(ddsHeader, 0);
+ byteArray.set(ddsData, 128);
+ that.finish(byteArray);
+ });
+ } else {
+''', '' if not crunch else '''
+ }
+''')
counter = 0
for file_ in data_files: