aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemcc5
-rw-r--r--tools/shared.py8
2 files changed, 8 insertions, 5 deletions
diff --git a/emcc b/emcc
index aa8827da..d8c41512 100755
--- a/emcc
+++ b/emcc
@@ -414,7 +414,10 @@ if TEMP_DIR:
shutil.rmtree(temp_dir) # clear it
os.makedirs(temp_dir)
else:
- temp_dir = tempfile.mkdtemp()
+ temp_root = os.path.join(shared.TEMP_DIR, 'emcc')
+ if not os.path.exists(temp_root):
+ os.makedirs(temp_root)
+ temp_dir = tempfile.mkdtemp(dir=temp_root)
def in_temp(name):
return os.path.join(temp_dir, os.path.basename(name))
diff --git a/tools/shared.py b/tools/shared.py
index 2149df0a..f6943c92 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -169,11 +169,11 @@ if os.environ.get('EMCC_DEBUG'):
EMSCRIPTEN_TEMP_DIR = CANONICAL_TEMP_DIR
if not os.path.exists(EMSCRIPTEN_TEMP_DIR):
os.makedirs(EMSCRIPTEN_TEMP_DIR)
- except:
- print >> sys.stderr, 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten'
+ except Exception, e:
+ print >> sys.stderr, e, 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten'
if not EMSCRIPTEN_TEMP_DIR:
- EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_')
+ EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_', dir=TEMP_DIR)
def clean_temp():
try_delete(EMSCRIPTEN_TEMP_DIR)
atexit.register(clean_temp)
@@ -483,7 +483,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
.replace('$EMSCRIPTEN_ROOT', path_from_root('').replace('\\', '/')) \
.replace('$CFLAGS', env['CFLAGS']) \
.replace('$CXXFLAGS', env['CFLAGS'])
- toolchainFile = mkstemp(suffix='.txt')[1]
+ toolchainFile = mkstemp(suffix='.cmaketoolchain.txt', dir=TEMP_DIR)[1]
open(toolchainFile, 'w').write(CMakeToolchain)
args.append('-DCMAKE_TOOLCHAIN_FILE=%s' % os.path.abspath(toolchainFile))
return args