From 15d9753a460f0c6b30c6baea88ce588f92626b74 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 17 Jan 2002 15:49:06 +0000 Subject: [PATCH] Make automatic detection of ANT_HOME work if ant is a symlink to the actual ant script using a relative path as well. Submitted by: Leon Breedt git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270777 13f79535-47bb-0310-9956-ffa450edef68 --- src/script/ant | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/script/ant b/src/script/ant index dad998070..f80504aaf 100644 --- a/src/script/ant +++ b/src/script/ant @@ -28,6 +28,10 @@ if [ -z "$ANT_HOME" ] ; then ## resolve links - $0 may be a link to ant's home PRG=$0 progname=`basename $0` + saveddir=`pwd` + + # need this for relative symlinks + cd `dirname $PRG` while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` @@ -41,6 +45,10 @@ if [ -z "$ANT_HOME" ] ; then ANT_HOME=`dirname "$PRG"`/.. + # make it fully qualified + ANT_HOME=`cd "$ANT_HOME" && pwd` + + cd $saveddir fi # For Cygwin, ensure paths are in UNIX format before anything is touched