--- Vladimir Egorov <[EMAIL PROTECTED]> wrote:
> Hi Ant Users,
>
> I am using FileList to specify collection of files
> one by one. I need to
> ensure that the specified files exist.
There are different things you can do here. Are you
using a predefined "files" attribute, in a property
perhaps? In current versions of Ant (I think it was
you who said you couldn't upgrade):
<project>
<property name="files" value="foo,bar,baz" />
<fileset id="fs" dir="${basedir}"
includes="${files}" />
<filelist id="fl" dir="${basedir}" files="${files}"
/>
<pathconvert property="fs" dirsep="" pathsep=""
refid="fs">
<mergemapper to="." />
</pathconvert>
<pathconvert property="fl" dirsep="" pathsep=""
refid="fl">
<mergemapper to="." />
</pathconvert>
<fail>
<condition>
<not>
<equals arg1="${fs}" arg2="${fl}" />
</not>
</condition>
</fail>
</project>
You can replace <fail><condition /></fail>, etc. with
antunit assertions if you like...
In Ant 1.7, it's slightly more straightforward:
<project>
<property name="files" value="foo,bar,baz" />
<filelist id="fl" dir="${basedir}" files="${files}"
/>
<fail>
<condition>
<resourcecount when="gt" count="0">
<restrict>
<filelist dir="${basedir}" files="${files}"
/>
<not
xmlns="antlib:org.apache.tools.ant.types.resources.selectors">
<exists />
</not>
</restrict>
</resourcecount>
</condition>
</fail>
</project>
HTH,
Matt
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]