|
14 | 14 | from tools import shared
|
15 | 15 | from tools import jsrun, cache as cache_module, tempfiles
|
16 | 16 | from tools.response_file import read_response_file
|
| 17 | +from tools.shared import WINDOWS |
17 | 18 |
|
18 | 19 | __rootpath__ = os.path.abspath(os.path.dirname(__file__))
|
19 | 20 | def path_from_root(*pathelems):
|
@@ -708,13 +709,15 @@ def fix(m):
|
708 | 709 | funcs_js[i] = None
|
709 | 710 | funcs_js_item = indexize(funcs_js_item)
|
710 | 711 | funcs_js_item = blockaddrsize(funcs_js_item)
|
| 712 | + if WINDOWS: funcs_js_item = funcs_js_item.replace('\r\n', '\n') # Normalize to UNIX line endings, otherwise writing to text file will duplicate \r\n to \r\r\n! |
711 | 713 | outfile.write(funcs_js_item)
|
712 | 714 | funcs_js = None
|
713 | 715 |
|
714 |
| - outfile.write(indexize(post)) |
715 |
| - if DEBUG: logging.debug(' emscript: phase 3 took %s seconds' % (time.time() - t)) |
716 |
| - |
| 716 | + indexized = indexize(post) |
| 717 | + if WINDOWS: indexized = indexized.replace('\r\n', '\n') # Normalize to UNIX line endings, otherwise writing to text file will duplicate \r\n to \r\r\n! |
| 718 | + outfile.write(indexized) |
717 | 719 | outfile.close()
|
| 720 | + if DEBUG: logging.debug(' emscript: phase 3 took %s seconds' % (time.time() - t)) |
718 | 721 |
|
719 | 722 | # emscript_fast: emscript'en code using the 'fast' compilation path, using
|
720 | 723 | # an LLVM backend
|
@@ -1316,9 +1319,11 @@ def fix(m):
|
1316 | 1319 | outfile.write("var SYMBOL_TABLE = %s;" % json.dumps(symbol_table).replace('"', ''))
|
1317 | 1320 |
|
1318 | 1321 | for i in range(len(funcs_js)): # do this loop carefully to save memory
|
| 1322 | + if WINDOWS: funcs_js[i] = funcs_js[i].replace('\r\n', '\n') # Normalize to UNIX line endings, otherwise writing to text file will duplicate \r\n to \r\r\n! |
1319 | 1323 | outfile.write(funcs_js[i])
|
1320 | 1324 | funcs_js = None
|
1321 | 1325 |
|
| 1326 | + if WINDOWS: post = post.replace('\r\n', '\n') # Normalize to UNIX line endings, otherwise writing to text file will duplicate \r\n to \r\r\n! |
1322 | 1327 | outfile.write(post)
|
1323 | 1328 |
|
1324 | 1329 | outfile.close()
|
|
0 commit comments