ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Christiansen" <Nathan_Christian...@morinda.com>
Subject RE: Patternsets and Filesets
Date Thu, 12 Dec 2002 22:34:02 GMT
Yes. I'm running on *nix. The cool thing about it is that you can add things to your initial
fileset without changing the rest.

So a cross-platform example would be (tested on Linux and Windows 2000):

<property name="web.src.dir" value="${basedir}${file.separator}src" />
<property name="web.deploy.dir" value="${basedir}${file.separator}deploy" />

<fileset id="web.src.files" dir="${web.src.dir}">
  <include name="images/*.gif" />
  <include name="images/*.jpg" />
  <include name="javascript/*.js" />
  <include name="stylesheets/*.css" />
</fileset>

<pathconvert pathsep="," property="files" refid="web.src.files">
  <map from="${web.src.dir}${file.separator}" to="" />
</pathconvert>

<delete>
  <fileset dir="${web.deploy.dir}" includes="${files}" />
</delete>


-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com]
Sent: Thursday, December 12, 2002 3:06 PM
To: 'Ant Users List'
Subject: RE: Patternsets and Filesets


Cool ;-) And congratulations ;-)

Are you running on *nix? I would guess so, because of your
from="${web.src.dir}/". I'm not 100% sure, but I believe you have to be
careful with the path separator you use. To be really cross-platform, you
should do:

<property name="web.src.dir" location="..." />

<fileset id="myfiles" dir="${web.src.dir}/images">
  <include name="*.gif" />
  <include name="*.jpg" />
</fileset>

<pathconvert pathsep="," property="files" refid="myfiles">
  <map from="${web.src.dir}${file.separator}" to="" />
</pathconvert>

<delete>
  <fileset dir="${web.deploy.dir}" includes="${files}" />
</delete>

Note the use of <property location="" /> for the property used in <map
from=""/> and the use of ${file.separator} instead of /.

But if you are on Windows, then I'm wrong. --DD


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


Mime
View raw message