diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-23 10:23:48 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-23 10:23:48 -0800 |
commit | 358b3f87e53d1e85fad0348ffa4686b5acc0b9cd (patch) | |
tree | 409815e12feddd4c84a5630a14799e26dcdd75e5 /tools | |
parent | 15da1e17054f636be5fc670cc05c912108b3529c (diff) |
fix crash when TEMP_DIR not defined in ~/.emscripten
Diffstat (limited to 'tools')
-rw-r--r-- | tools/shared.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/shared.py b/tools/shared.py index 86a6463f..777566cc 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -112,12 +112,16 @@ JS_OPTIMIZER = path_from_root('tools', 'js-optimizer.js') # Temp dir -EMSCRIPTEN_TEMP_DIR = os.path.join(TEMP_DIR, 'emscripten_test') -if not os.path.exists(EMSCRIPTEN_TEMP_DIR): - try: - os.makedirs(EMSCRIPTEN_TEMP_DIR) - except Exception, e: - print >> sys.stderr, 'Warning: Could not create temp dir (%s): %s' % (EMSCRIPTEN_TEMP_DIR, str(e)) +try: + EMSCRIPTEN_TEMP_DIR = os.path.join(TEMP_DIR, 'emscripten_temp') + if not os.path.exists(EMSCRIPTEN_TEMP_DIR): + try: + os.makedirs(EMSCRIPTEN_TEMP_DIR) + except Exception, e: + print >> sys.stderr, 'Warning: Could not create temp dir (%s): %s' % (EMSCRIPTEN_TEMP_DIR, str(e)) +except: + EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_') + print >> sys.stderr, 'Warning: TEMP_DIR not defined in ~/.emscripten, using %s' % EMSCRIPTEN_TEMP_DIR # ~/.emscripten stuff |