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.

Attachment: ant.bat.diff
Description: Binary data

Reply via email to