Skip to content

Commit

Permalink
Adding symlink support to the cake console executable
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 15, 2011
1 parent 6d9b709 commit 36fa2e8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
10 changes: 9 additions & 1 deletion app/Console/cake
Expand Up @@ -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)

This comment has been minimized.

Copy link
@tPl0ch

tPl0ch Oct 17, 2011

I think this has to be SYM=$(readlink "$LIB") (mind the double quotes), otherwise directories with whitespaces will be cut off.

This comment has been minimized.

Copy link
@lorenzo

lorenzo Oct 17, 2011

Author Member

Yeah, that was fixed in a later commit. Thanks!

LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done

LIB=$(dirname -- "$LIB")/
APP=`pwd`

exec php -q ${LIB}cake.php -working "${APP}" "$@"
Expand Down
12 changes: 10 additions & 2 deletions lib/Cake/Console/Templates/skel/Console/cake
Expand Up @@ -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;
10 changes: 9 additions & 1 deletion lib/Cake/Console/cake
Expand Up @@ -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}" "$@"
Expand Down

0 comments on commit 36fa2e8

Please sign in to comment.