summaryrefslogtreecommitdiff
path: root/src/script/ant
diff options
context:
space:
mode:
authorStefan Bodewig <bodewig@apache.org>2002-01-17 15:49:06 +0000
committerStefan Bodewig <bodewig@apache.org>2002-01-17 15:49:06 +0000
commit15d9753a460f0c6b30c6baea88ce588f92626b74 (patch)
tree455bb492292aa314a01160be7a53115f686a9654 /src/script/ant
parentbfc6ef8295b44eea9ded49c346470c7a7d0c6ee5 (diff)
downloadant-15d9753a460f0c6b30c6baea88ce588f92626b74.tar.gz
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 <ljb@neverborn.ORG> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270777 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/script/ant')
-rw-r--r--src/script/ant8
1 files changed, 8 insertions, 0 deletions
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