From fe2f56e8bd18cac0ca92be3b9e736251d0a96f06 Mon Sep 17 00:00:00 2001
From: mark_story <mark@mark-story.com>
Date: Tue, 18 Dec 2012 20:31:57 -0500
Subject: [PATCH] Fix path resolution when app dir has been renamed.

This solves path resolution when the default app dir has bee
renamed, and a relative path is used to run `cake`

Fixes #3474
---
 lib/Cake/Console/cake | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/Cake/Console/cake b/lib/Cake/Console/cake
index d3ae6b885..37742800c 100755
--- a/lib/Cake/Console/cake
+++ b/lib/Cake/Console/cake
@@ -21,6 +21,10 @@
 # Canonicalize by following every symlink of the given name recursively
 canonicalize() {
 	NAME=$1
+	if [ -f "$NAME" ]
+	then
+		NAME=$(cd -P -- "$(dirname -- "$NAME")" && pwd -P)/$(basename -- "$NAME")
+	fi
 	while [ -h "$NAME" ]; do
 		DIR=$(dirname -- "$NAME")
 		SYM=$(readlink "$NAME")