Skip to content

Commit de01380

Browse files
committed
Support emsdk --embedded mode
This change allows emsdk --embdded mode to work out of the box without running emsdk_env.sh. This paves makes it easier to justify using embedded mode by default: emscripten-core/emsdk#472 This is part of a larger plan to avoid using the $HOME directory to store anything at all: #9543
1 parent 63244f5 commit de01380

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/shared.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ def generate_config(path, first_time=False):
265265
# 4. Fall back users home directory (~/.emscripten).
266266

267267
embedded_config = path_from_root('.emscripten')
268+
# For compatability with emsdk --embedded mode also look two levels up. This
269+
# could be removed in emsdk was use the emscripten directory itself for the
270+
# embedded config: https://github.com/emscripten-core/emsdk/pull/367
271+
emsdk_root = os.path.dirname(os.path.dirname(__rootpath__))
272+
emsdk_embedded_config = os.path.join(emsdk_root, '.emscripten')
273+
268274
if '--em-config' in sys.argv:
269275
EM_CONFIG = sys.argv[sys.argv.index('--em-config') + 1]
270276
# And now remove it from sys.argv
@@ -289,6 +295,8 @@ def generate_config(path, first_time=False):
289295
EM_CONFIG = os.environ['EM_CONFIG']
290296
elif os.path.exists(embedded_config):
291297
EM_CONFIG = embedded_config
298+
elif os.path.exists(emsdk_embedded_config):
299+
EM_CONFIG = emsdk_embedded_config
292300
else:
293301
EM_CONFIG = '~/.emscripten'
294302

0 commit comments

Comments
 (0)