From 01b3da95577d0dc44edc12c5a9e14064010162a9 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Sat, 11 Feb 2017 18:44:51 +0000 Subject: [PATCH] Search for .mem in same directory as Node script This seems to be a common source of issues when trying to run optimized code with separate .js.mem from Node.js, while not being in the same working directory. It was possible to workaround this and set search path using memoryInitializerPrefixURL since 7e9e24, but I think it makes sense to have a nice default for 90% of cases too, which would be to search for .js.mem file in the same directory as .js itself when running using Node.js. --- src/postamble.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/postamble.js b/src/postamble.js index cd966c19bf74b..9d50c955b2efb 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -41,6 +41,8 @@ if (memoryInitializer) { memoryInitializer = Module['locateFile'](memoryInitializer); } else if (Module['memoryInitializerPrefixURL']) { memoryInitializer = Module['memoryInitializerPrefixURL'] + memoryInitializer; + } else if (ENVIRONMENT_IS_NODE) { + memoryInitializer = __dirname + '/' + memoryInitializer; } if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { var data = Module['readBinary'](memoryInitializer);