ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Kennard <pet...@livingwork.com>
Subject Re: Multiple files to <java> task
Date Sat, 20 Jan 2007 07:59:55 GMT
OK - convoluted nastiness but it works to make a quoted space 
delimited list of file names.

The two "commands" below are needed to translate all the '/' to 
${file.separator} s in the
original property which are coded with '/' separators. and expand it to
the full path so it will compare character for character with the
path built by the final fileset.

<path id="xmlcode.dir">
      <pathelement location="${src.home}/XMLSource"/>
</path>

<pathconvert
      property="xmlcodedir"
      refid="xmlcode.dir"
/>

Now I can create the fileset for the source directory


<fileset dir="${xmlcodedir}" id="xmlcode.files">
      <include name="*.xml"/>
</fileset>

this will "map out" the path to ""
and will put '" "' between every two entries

<pathconvert targetos="unix"
              pathsep="&quot; &quot;"
              property="xmlfiles"
              refid="xmlcode.files"
 >
     <map from="${xmlcodedir}" to=""/>
</pathconvert>

Now you just have to add the leading and trailing '"' and you have
a nice quoted space delimited list of files. (hopefully suitable for 
a command line="" argument in a <java/> task :)

<echo message="&quot;${xmlfiles}&quot;${line.separator}" />

~
~


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message