diff --git a/app/Console/cake b/app/Console/cake index ca3e57ca3..49f2eaa12 100755 --- a/app/Console/cake +++ b/app/Console/cake @@ -12,15 +12,20 @@ # # @copyright Copyright 2005-2012, Cake Software Foundation, Inc. # @link http://cakephp.org CakePHP(tm) Project -# @package app.Console -# @since CakePHP(tm) v 2.0 +# @package cake.Console +# @since CakePHP(tm) v 1.2.0.5012 # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ # Canonicalize by following every symlink of the given name recursively canonicalize() { - NAME=$1 + NAME="$1" + if [ -f "$NAME" ] + then + DIR=$(dirname -- "$NAME") + NAME=$(cd -P "$DIR" && pwd -P)/$(basename -- "$NAME") + fi while [ -h "$NAME" ]; do DIR=$(dirname -- "$NAME") SYM=$(readlink "$NAME") @@ -29,9 +34,8 @@ canonicalize() { echo "$NAME" } -CONSOLE=$(dirname $(canonicalize "$0")) -APP=$(dirname "$CONSOLE") +CONSOLE=$(dirname -- "$(canonicalize "$0")") +APP=`pwd` -exec php -q $CONSOLE/cake.php -working "$APP" "$@" - -exit; +exec php -q "$CONSOLE"/cake.php -working "$APP" "$@" +exit diff --git a/lib/Cake/Console/Templates/skel/Console/cake b/lib/Cake/Console/Templates/skel/Console/cake index ca3e57ca3..49f2eaa12 100644 --- a/lib/Cake/Console/Templates/skel/Console/cake +++ b/lib/Cake/Console/Templates/skel/Console/cake @@ -12,15 +12,20 @@ # # @copyright Copyright 2005-2012, Cake Software Foundation, Inc. # @link http://cakephp.org CakePHP(tm) Project -# @package app.Console -# @since CakePHP(tm) v 2.0 +# @package cake.Console +# @since CakePHP(tm) v 1.2.0.5012 # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ # Canonicalize by following every symlink of the given name recursively canonicalize() { - NAME=$1 + NAME="$1" + if [ -f "$NAME" ] + then + DIR=$(dirname -- "$NAME") + NAME=$(cd -P "$DIR" && pwd -P)/$(basename -- "$NAME") + fi while [ -h "$NAME" ]; do DIR=$(dirname -- "$NAME") SYM=$(readlink "$NAME") @@ -29,9 +34,8 @@ canonicalize() { echo "$NAME" } -CONSOLE=$(dirname $(canonicalize "$0")) -APP=$(dirname "$CONSOLE") +CONSOLE=$(dirname -- "$(canonicalize "$0")") +APP=`pwd` -exec php -q $CONSOLE/cake.php -working "$APP" "$@" - -exit; +exec php -q "$CONSOLE"/cake.php -working "$APP" "$@" +exit