aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-10-21 17:36:03 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-21 17:36:03 -0700
commite0c3cd79dbfb4b1f5230b9a1589a3b1bedaa387d (patch)
treece9ef8d214397381dfaacf87b5440744ae794514 /emcc
parent60e3202da0db59b42a6702c96b06f3899dbf09f2 (diff)
add file handling code from --preload-file etc. in a pre-js, so that it will be able to start network access as early as possible
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc9
1 files changed, 3 insertions, 6 deletions
diff --git a/emcc b/emcc
index 2aa223db..4222caa3 100755
--- a/emcc
+++ b/emcc
@@ -1654,7 +1654,7 @@ try:
# Embed and preload files
if len(preload_files) + len(embed_files) > 0:
logging.debug('setting up files')
- file_args = []
+ file_args = ['--pre-run']
if len(preload_files) > 0:
file_args.append('--preload')
file_args += preload_files
@@ -1665,11 +1665,8 @@ try:
file_args += ['--compress', Compression.encoder, Compression.decoder, Compression.js_name]
if use_preload_cache:
file_args.append('--use-preload-cache')
- code = execute([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
- src = open(final).read().replace('// {{PRE_RUN_ADDITIONS}}', '// {{PRE_RUN_ADDITIONS}}\n' + code)
- final += '.files.js'
- open(final, 'w').write(src)
- if DEBUG: save_intermediate('files')
+ file_code = execute([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
+ pre_js = file_code + pre_js
# Apply pre and postjs files
if pre_js or post_js: