From a8146983fed1a8134c01f28bf27e1ae0ce81bad9 Mon Sep 17 00:00:00 2001 From: mhenschel Date: Tue, 6 Oct 2015 19:13:18 +0200 Subject: [PATCH] Make .emscripten config file relocatable when using the --embedded flag I'd like to copy the emsdk directory around freely. This will derive the location of all the tools from the location of the .emscripten file. --- emsdk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/emsdk b/emsdk index 6cbe0fe..e4fb066 100755 --- a/emsdk +++ b/emsdk @@ -724,6 +724,7 @@ def generate_dot_emscripten(active_tools): if emscripten_config_directory == emsdk_path(): temp_dir = sdk_path('tmp') mkdir_p(temp_dir) + embedded=True else: temp_dir = tempfile.gettempdir().replace('\\', '/') @@ -731,6 +732,9 @@ def generate_dot_emscripten(active_tools): has_node = False cfg = 'import os\n' + + if embedded: + cfg += 'emsdk_path=os.path.dirname(EM_CONFIG)\n' for tool in active_tools: tool_cfg = tool.activated_config() @@ -754,6 +758,9 @@ COMPILER_ENGINE = NODE_JS JS_ENGINES = [NODE_JS] ''' + if embedded: + cfg = cfg.replace(emscripten_config_directory, '\' + emsdk_path + \'') + with open(dot_emscripten_path(), "w") as text_file: text_file.write(cfg) # Clear old cached emscripten content.