From 2fc268b364fae3055a812643e69214f1bd07e67f Mon Sep 17 00:00:00 2001 From: Aidan Hobson Sayers Date: Tue, 18 Nov 2014 00:42:02 +0000 Subject: [PATCH] Improve cross-shell compatibility --- emsdk_env.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/emsdk_env.sh b/emsdk_env.sh index 5c39ef6..8d19fcb 100755 --- a/emsdk_env.sh +++ b/emsdk_env.sh @@ -1,6 +1,14 @@ -#!/bin/bash +# This script is sourced by the user and uses +# their shell. Try not to use bashisms. + +SRC="$BASH_SOURCE" +if [ "$SRC" = "" ]; then + SRC="$_" +fi +pushd `dirname "$SRC"` > /dev/null +unset SRC -pushd `dirname "$BASH_SOURCE"` > /dev/null ./emsdk construct_env -source ./emsdk_set_env.sh +. ./emsdk_set_env.sh + popd > /dev/null