Skip to content

Commit 36fa2e8

Browse files
committed
Adding symlink support to the cake console executable
1 parent 6d9b709 commit 36fa2e8

File tree

3 files changed

+28
-4
lines changed
  • app/Console
  • lib/Cake/Console

3 files changed

+28
-4
lines changed

app/Console/cake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@
1717
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
1818
#
1919
################################################################################
20-
LIB=${0/%cake/}
20+
LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
21+
22+
while [ -h $LIB ]; do
23+
DIR=$(dirname -- "$LIB")
24+
SYM=$(readlink $LIB)
25+
LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
26+
done
27+
28+
LIB=$(dirname -- "$LIB")/
2129
APP=`pwd`
2230

2331
exec php -q ${LIB}cake.php -working "${APP}" "$@"

lib/Cake/Console/Templates/skel/Console/cake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@
1717
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
1818
#
1919
################################################################################
20-
LIB=${0/%cake/}
20+
LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
21+
22+
while [ -h $LIB ]; do
23+
DIR=$(dirname -- "$LIB")
24+
SYM=$(readlink $LIB)
25+
LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
26+
done
27+
28+
LIB=$(dirname -- "$LIB")/
2129
APP=`pwd`
2230

2331
exec php -q ${LIB}cake.php -working "${APP}" "$@"
2432

25-
exit;
33+
exit;

lib/Cake/Console/cake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@
1717
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
1818
#
1919
################################################################################
20-
LIB=${0/%cake/}
20+
LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
21+
22+
while [ -h $LIB ]; do
23+
DIR=$(dirname -- "$LIB")
24+
SYM=$(readlink $LIB)
25+
LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
26+
done
27+
28+
LIB=$(dirname -- "$LIB")/
2129
APP=`pwd`
2230

2331
exec php -q ${LIB}cake.php -working "${APP}" "$@"

0 commit comments

Comments
 (0)