diff --git a/emsdk b/emsdk index 660e65a..c77c08f 100755 --- a/emsdk +++ b/emsdk @@ -1232,6 +1232,11 @@ JS_ENGINES = [NODE_JS] if embedded: cfg = cfg.replace(emscripten_config_directory, "' + emsdk_path + '") + if os.path.exists(dot_emscripten_path()): + backup_path = dot_emscripten_path() + ".old" + print("Backing up old Emscripten configuration file in " + os.path.normpath(backup_path)) + move_with_overwrite(dot_emscripten_path(), backup_path) + with open(dot_emscripten_path(), "w") as text_file: text_file.write(cfg) # Clear old cached emscripten content. diff --git a/test.py b/test.py index 4b3713a..c2baf5e 100644 --- a/test.py +++ b/test.py @@ -104,7 +104,9 @@ assert not os.path.exists(LIBC) print('test tot-upstream') check_call('./emsdk install tot-upstream') assert not os.path.exists(LIBC) +old_config = open(os.path.expanduser('~/.emscripten')).read() check_call('./emsdk activate tot-upstream') +assert old_config == open(os.path.expanduser('~/.emscripten.old')).read() assert os.path.exists(LIBC), 'activation supplies prebuilt libc' # TODO; test on latest as well check_call('upstream/emscripten/emcc hello_world.cpp') @@ -162,4 +164,3 @@ for os, suffix in [ url = 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/%s/%s/wasm-binaries.%s' % (os, latest_hash, suffix) print(' url: ' + url), check_call('wget ' + url) -