ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Bergbauer" <vincent_bergba...@yahoo.com>
Subject Patch: Making ANT_HOME easier to find on WinNT/2000
Date Tue, 17 Oct 2000 19:08:37 GMT
ant.bat tries to guess where Ant's directory is.
On Windows NT/2000, you can use %~dp0 to find the path of a batch file.
This takes the guess work out of finding ANT_HOME.
Since this is a feature of the Windows NT/2000 command shell, I first check
if "%OS%"=="Windows_NT", which is true for all versions of WinNT/2000.

All we need is to add the following lines at the beginning of the ant.bat file (before the

command line argument "slurping" (I also attached a 'diff -u'):

rem When using Windows NT (or W2K), the path of the batch file
rem (and therefore ANT_HOME) can be determined.
if not "%OS%"=="Windows_NT" goto start
set DEFAULT_ANT_HOME=%~dp0
set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=%
if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME%
set DEFAULT_ANT_HOME=

:start

I tested this on Windows 2000sp1 both under DOS and Cygwin.
Cheers.
Vincent.

Mime
View raw message