diff --git a/app/Console/cake b/app/Console/cake index 64f91b5ba..010b675cf 100755 --- a/app/Console/cake +++ b/app/Console/cake @@ -17,7 +17,15 @@ # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ -LIB=${0/%cake/} +LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0") + +while [ -h $LIB ]; do + DIR=$(dirname -- "$LIB") + SYM=$(readlink $LIB) + LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") +done + +LIB=$(dirname -- "$LIB")/ APP=`pwd` exec php -q ${LIB}cake.php -working "${APP}" "$@" diff --git a/lib/Cake/Console/Templates/skel/Console/cake b/lib/Cake/Console/Templates/skel/Console/cake index 64f91b5ba..c1d97d22c 100644 --- a/lib/Cake/Console/Templates/skel/Console/cake +++ b/lib/Cake/Console/Templates/skel/Console/cake @@ -17,9 +17,17 @@ # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ -LIB=${0/%cake/} +LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0") + +while [ -h $LIB ]; do + DIR=$(dirname -- "$LIB") + SYM=$(readlink $LIB) + LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") +done + +LIB=$(dirname -- "$LIB")/ APP=`pwd` exec php -q ${LIB}cake.php -working "${APP}" "$@" -exit; +exit; \ No newline at end of file diff --git a/lib/Cake/Console/cake b/lib/Cake/Console/cake index 0a00259b8..05b813e99 100755 --- a/lib/Cake/Console/cake +++ b/lib/Cake/Console/cake @@ -17,7 +17,15 @@ # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ -LIB=${0/%cake/} +LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0") + +while [ -h $LIB ]; do + DIR=$(dirname -- "$LIB") + SYM=$(readlink $LIB) + LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") +done + +LIB=$(dirname -- "$LIB")/ APP=`pwd` exec php -q ${LIB}cake.php -working "${APP}" "$@"