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.
This commit is contained in:
mhenschel
2015-10-06 19:13:18 +02:00
parent 340543a46a
commit a8146983fe

7
emsdk
View File

@@ -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.