diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-12-29 13:20:48 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-12-29 13:20:48 -0500 |
commit | 7b9f47555515346b1b04d8b9eb599a931e6b56da (patch) | |
tree | 21db9ed3ef373140826d9ee17a762eb0a4a33803 | |
parent | 15e19544fadfbeba159a0f0310fe1f92ae5fdd0c (diff) |
chunk very large embed-file
-rw-r--r-- | tools/file_packager.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/file_packager.py b/tools/file_packager.py index 33082ac2..7e196efd 100644 --- a/tools/file_packager.py +++ b/tools/file_packager.py @@ -252,7 +252,17 @@ for file_ in data_files: filename = file_['name'] if file_['mode'] == 'embed': # Embed - code += '''Module['FS_createDataFile']('/%s', '%s', %s, true, true);\n''' % (os.path.dirname(filename), os.path.basename(filename), str(map(ord, open(file_['localname'], 'rb').read()))) + data = map(ord, open(file_['localname'], 'rb').read()) + str_data = '' + chunk_size = 10240 + while len(data) > 0: + chunk = data[:chunk_size] + data = data[chunk_size:] + if not str_data: + str_data = str(chunk) + else: + str_data += '.concat(' + str(chunk) + ')' + code += '''Module['FS_createDataFile']('/%s', '%s', %s, true, true);\n''' % (os.path.dirname(filename), os.path.basename(filename), str_data) elif file_['mode'] == 'preload': # Preload varname = 'filePreload%d' % counter |