Back up overwritten configuration files (#295)

This commit is contained in:
Thomas Lively
2019-07-03 16:11:00 -07:00
committed by GitHub
parent c3f0e0fc0d
commit 35cd9268f0
2 changed files with 7 additions and 1 deletions

5
emsdk
View File

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