Skip to content

Commit

Permalink
npm-flexjs: shell scripts detect sdk location by detecting if they we…
Browse files Browse the repository at this point in the history
…re run as symlinks, if required (references #8)
  • Loading branch information
joshtynjala committed Aug 17, 2016
1 parent 1cd590f commit 96f4e39
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
14 changes: 10 additions & 4 deletions npm-flexjs/js/bin/asjscnpm
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@
# In Windows Command Prompt, use mxmlc.bat instead.
#

function abspath() { pushd . > /dev/null; if [ -d "$1" ]; then cd "$1"; dirs -l +0; else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`; if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`"; else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null; }
SCRIPT_REAL_FILE=`readlink "$0" || echo "$0"`;
SCRIPT_ABS_PATH=`abspath "$SCRIPT_REAL_FILE"`
SCRIPT_HOME=`dirname "$SCRIPT_ABS_PATH"`
SCRIPT_HOME="$0"
# try to find the real script if $0 is a symlink
pushd . > /dev/null
if [ -h "$SCRIPT_HOME" ]; then
cd "`dirname "$SCRIPT_HOME"`"
SCRIPT_HOME="`readlink "\`basename $SCRIPT_HOME\`"`"
fi
cd "`dirname "${SCRIPT_HOME}"`"
SCRIPT_HOME="`pwd`"
popd > /dev/null
FALCON_HOME=${SCRIPT_HOME}/../..
FLEX_HOME=${SCRIPT_HOME}/../..

Expand Down
14 changes: 10 additions & 4 deletions npm-flexjs/js/bin/asjscompcnpm
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@
# In Windows Command Prompt, use mxmlc.bat instead.
#

function abspath() { pushd . > /dev/null; if [ -d "$1" ]; then cd "$1"; dirs -l +0; else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`; if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`"; else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null; }
SCRIPT_REAL_FILE=`readlink "$0" || echo "$0"`;
SCRIPT_ABS_PATH=`abspath "$SCRIPT_REAL_FILE"`
SCRIPT_HOME=`dirname "$SCRIPT_ABS_PATH"`
SCRIPT_HOME="$0"
# try to find the real script if $0 is a symlink
pushd . > /dev/null
if [ -h "$SCRIPT_HOME" ]; then
cd "`dirname "$SCRIPT_HOME"`"
SCRIPT_HOME="`readlink "\`basename $SCRIPT_HOME\`"`"
fi
cd "`dirname "${SCRIPT_HOME}"`"
SCRIPT_HOME="`pwd`"
popd > /dev/null
FALCON_HOME=${SCRIPT_HOME}/../..
FLEX_HOME=${SCRIPT_HOME}/../..

Expand Down
14 changes: 10 additions & 4 deletions npm-flexjs/js/bin/mxmlcnpm
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@
# In Windows Command Prompt, use mxmlc.bat instead.
#

function abspath() { pushd . > /dev/null; if [ -d "$1" ]; then cd "$1"; dirs -l +0; else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`; if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`"; else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null; }
SCRIPT_REAL_FILE=`readlink "$0" || echo "$0"`;
SCRIPT_ABS_PATH=`abspath "$SCRIPT_REAL_FILE"`
SCRIPT_HOME=`dirname "$SCRIPT_ABS_PATH"`
SCRIPT_HOME="$0"
# try to find the real script if $0 is a symlink
pushd . > /dev/null
if [ -h "$SCRIPT_HOME" ]; then
cd "`dirname "$SCRIPT_HOME"`"
SCRIPT_HOME="`readlink "\`basename $SCRIPT_HOME\`"`"
fi
cd "`dirname "${SCRIPT_HOME}"`"
SCRIPT_HOME="`pwd`"
popd > /dev/null
if [ "x${FALCON_HOME}" = "x" ]
then
FALCON_HOME=${SCRIPT_HOME}/../..
Expand Down

0 comments on commit 96f4e39

Please sign in to comment.