You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by JOHN BISKEBORN <jb...@msn.com> on 2003/01/24 21:07:09 UTC

for loop in ant.bat fails on ant-1.5.1 on Windows 9x

Hi,

I thought you might be interested in a fix for problem I ran into with ant-1.5.1.

First I had to change:
if exist "%ANT_HOME%" goto checkJava
to: 
if exist "%ANT_HOME%"\nul goto checkJava

I think this has already been reported in bug 14495.

Then I found the for loop in :checkJava couldn't handle the second dot in ant-1.5.1.  In other words, the for loop worked fine with ant-1.5 but not ant-1.5.1 when the .1 was added.  I also found it wasn't a matter of being too long; it just plain didn't like seeing another extension.

To get it to work I changed:
for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" %%i
to:
rem Substitute virtual disk z: for %ANT_HOME% in for loop.
subst z: %ANT_HOME%
for %%i in ("z:\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" %%I

and after :end I added:
rem Delete virtual disk z: used above.
if exist z:\nul subst z: /d

The for loop was happy with the set (z:\lib\*.jar).

Regards,

John