Skip to content
Permalink
Browse files
npm-flexjs: shell scripts detect sdk location by detecting if they we…
…re run as symlinks, if required (references #8)
  • Loading branch information
joshtynjala committed Aug 17, 2016
1 parent 1cd590f commit 96f4e398a8895500f33bb197858222f47c951f7e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
@@ -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}/../..

@@ -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}/../..

@@ -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}/../..

0 comments on commit 96f4e39

Please sign in to comment.