Bug 26947 - ant.bat should detect if ANT_HOME ends in a backslash
Summary: ant.bat should detect if ANT_HOME ends in a backslash
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Wrapper scripts (show other bugs)
Version: 1.7.1
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
: 40872 (view as bug list)
Depends on:
Reported: 2004-02-15 01:26 UTC by Robert Neville
Modified: 2008-07-10 09:48 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Robert Neville 2004-02-15 01:26:21 UTC
I've just spent the last several hours debugging why ant would not launch.  
Granted a dum-dum on my part but to save future users the grief I would add a 
statement to the installation instructions that specify to leave off the 
trailing \ in the ANT_HOME env variable on Windows as this will cause the 
ant.bat script to FAIL.

Comment 1 Antoine Levy-Lambert 2004-02-15 10:47:02 UTC
First of all *thanks* for submitting the first ant 1.6.1 bug report, this is
worth drinking a glass of wine.

Second, you have been caught by an annoyance which has hit other people in the past.

I suggest to do the following in ant.bat (will work only under NTish operating
systems, but this is the tendency of the batch anyway) :

for %a in (%ANT_HOME%) do set ANT_PARENT_DIR=%~dpa
if "%ANT_PARENT_DIR%"=="%ANT_HOME%" goto error
goto next
echo ANT_HOME *must not* end with a backslash
echo you have set ANT_HOME to %ANT_HOME%
exit 1

Comment 2 Dominique Devienne 2004-02-16 15:15:58 UTC
Well, as you write Antoine, %~dpa is not portable to Win9x...

I used to do the following HACK to get rid of trailing slashes:
:: Remove back-slash or forward-slash at end of path, if any

Used to work, but was not tested on all platforms. Should work on WinNT, Win2K, 
WinXP. --DD
Comment 3 Steve Loughran 2006-06-27 18:22:13 UTC
If we strip win9x support out of ant1.7 this fix can be applied.
Comment 4 Peter Reilly 2006-11-02 05:19:37 UTC
*** Bug 40872 has been marked as a duplicate of this bug. ***
Comment 5 Stefan Bodewig 2008-07-10 07:58:35 UTC
The manual now states that ANT_HOME shouldn't end in a backslash.

Renaming the report and marking it as enhancement request - once we are ready to drop win95 support (or have we already?).
Comment 6 Matt Benson 2008-07-10 09:48:25 UTC
I thought we voted to drop support of Win95 & Win98 a couple of years back... IIRC Steve or I might have spearheaded that one.