ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <>
Subject [PATCH] ant.bat - fix for -D args with spaces
Date Sun, 28 Jan 2001 02:20:38 GMT

Here is a patch to ant.bat which fixes problems with spaces in the value
specified by a property such as -Dfoo="a b c".  Between the Ant 1.2
release and the current CVS version, someone changed the test in the
argument looping from %1a==a to "%1"=="" which broke the way quoted
arguments are appended together causing the script to fail.  In addition
to reverting this change, I made a small optimization for NT/2K so %* is
used to grab all the arguments instead of looping to get them.  As a
result, I renamed the target from "start" to "win9xArgs" which is now more
accurate.  Also made minor changes to a few of the comments.

This fix was tested on Windows NT 4.0 SP5 and Windows 98SE.

Here's a simple build file, proptest.xml:
<project name="PropTest" basedir="." default="main">
  <property name="p1" value="p1"/>
  <property name="p2" value="p2"/>
  <property name="p3" value="p3"/>
  <target name="main">

Sure -debug will output the properties but you have to run against some
build file.  Here is a sample command:
  ant -f proptest.xml -Dp1="C:\Prog files" -Dp2=hello2 -Dp3="D:\ant home"
which should output:
    p1="C:\Prog files"
    p3="D:\ant home"

-Bill Burton
View raw message