Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make app/Console/cake pwd insensitive on Mac OS X.

Follow up of [36e15a0].
  • Loading branch information...
commit 02cfacec4174d5e4467c5436de6193448b741866 1 parent 83d307e
@renan renan authored
View
27 app/Console/cake
@@ -17,22 +17,21 @@
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#
################################################################################
-if [[ `uname` =~ 'Darwin' ]]; then
- ME=$0
-else
- ME=$(readlink -f $0)
-fi
-LIB=$(cd -P -- "$(dirname -- "$ME")" && pwd -P) && LIB=$LIB/$(basename -- "$ME")
-while [ -h "$LIB" ]; do
- DIR=$(dirname -- "$LIB")
- SYM=$(readlink "$LIB")
- LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
+# Canonicalize by following every symlink of the given name recursively
+canonicalize() {
+ NAME=$1
+ while [ -h "$NAME" ]; do
+ DIR=$(dirname -- "$NAME")
+ SYM=$(readlink "$NAME")
+ NAME=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
+ done
+ echo "$NAME"
+}
-LIB=$(dirname -- "$LIB")/
-APP=$(dirname $(cd $(dirname $ME) && pwd))
+CONSOLE=$(dirname $(canonicalize "$0"))
+APP=$(dirname "$CONSOLE")
-exec php -q "$LIB"cake.php -working "$APP" "$@"
+exec php -q $CONSOLE/cake.php -working "$APP" "$@"
exit;
View
32 lib/Cake/Console/Templates/skel/Console/cake
@@ -10,24 +10,28 @@
# Licensed under The MIT License
# Redistributions of files must retain the above copyright notice.
#
-# @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
-# @link http://cakephp.org CakePHP(tm) Project
-# @package app.Console
-# @since CakePHP(tm) v 2.0
-# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+# @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
+# @link http://cakephp.org CakePHP(tm) Project
+# @package app.Console
+# @since CakePHP(tm) v 2.0
+# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#
################################################################################
-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
+# Canonicalize by following every symlink of the given name recursively
+canonicalize() {
+ NAME=$1
+ while [ -h "$NAME" ]; do
+ DIR=$(dirname -- "$NAME")
+ SYM=$(readlink "$NAME")
+ NAME=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
+ done
+ echo "$NAME"
+}
-LIB=$(dirname -- "$LIB")/
-APP=`pwd`
+CONSOLE=$(dirname $(canonicalize "$0"))
+APP=$(dirname "$CONSOLE")
-exec php -q "$LIB"cake.php -working "$APP" "$@"
+exec php -q $CONSOLE/cake.php -working "$APP" "$@"
exit;
View
20 lib/Cake/Console/cake
@@ -17,17 +17,21 @@
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#
################################################################################
-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
+# Canonicalize by following every symlink of the given name recursively
+canonicalize() {
+ NAME=$1
+ while [ -h "$NAME" ]; do
+ DIR=$(dirname -- "$NAME")
+ SYM=$(readlink "$NAME")
+ NAME=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
+ done
+ echo "$NAME"
+}
-LIB=$(dirname -- "$LIB")/
+CONSOLE=$(dirname $(canonicalize "$0"))
APP=`pwd`
-exec php -q "$LIB"cake.php -working "$APP" "$@"
+exec php -q $CONSOLE/cake.php -working "$APP" "$@"
exit;
Please sign in to comment.
Something went wrong with that request. Please try again.