ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Senger <>
Subject Re: Empty arguments on the command-line under windows
Date Thu, 01 Sep 2005 07:25:40 GMT
> This (condition task invocation) rewrites more simply :
> <property name="registry.cache.dir" value=""/>
> because ant only assigns a value to unexisting properties.
   You are, of course, completely right (thanks also to Ninju Bohra who
pointed to this, as well). I know that but sometimes I forget. Thanks...

> To solve your Windows problem, you can do :
> <property name="registry.cache.dir" value="&quot;&quot;"/>
> this might lead Windows to understand that there is an empty argument
   This is not bad (and I may use it, after all), but still it is not
OS-independent. Because linux takes literally what is there - so it takes
quotes as part of the parameters, windows does not. But at least, windows
let it as a parameter, so I can teach my program to take two double
quotes as an empty value.
   This is what it does:
The Ant task is now:

     <property name="" value="&quot;&quot;"/>

     <java classname="TestArgs" taskname="testing"
       classpathref="build.classpath" fork="true" failonerror="true">
       <arg value="-cacheDir"/>
       <arg value="${}"/>
       <arg value="-dt"/>

   This is an output (of a simple program that prints its argumenst) under
windows, if I do not set

  [testing] 0: -cacheDir
  [testing] 1: abc
  [testing] 2: -dt

   And the same under linux:

  [testing] 0: -cacheDir
  [testing] 1: ""
  [testing] 2: -dt

   I have feeling (but I may be wrong) that this kind of
OS-interoperability should be solved by Ant...

   Thanks, Martin

Martin Senger
   skype: martinsenger
consulting for:
   International Rice Research Institute
   Biometrics and Bioinformatics Unit
   DAPO BOX 7777, Metro Manila
   Philippines, phone: +63-2-580-5600 (ext.2324)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message