diff options
-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 |