I'd just use <property name="files_path" refid="fileset"> and then
check if property "files_path" is greater than zero.
<fileset dir="WebInfra/Source" id="fileset" includes="**/*">
<containsregexp expression="dg" />
</fileset>
<property name="files_path" refid="fileset">
<condition property="prop_from_condition">
<equals arg1="${files_path}" arg2=""/>
</condition>
That I believe works in 1.6.5. I took a quick look at a few other ways
using selectors, but I don't think those work with 1.6.5.
On 11/5/07, Jay Dickon Glanville <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I'm doing something, but I'm not sure I'm doing it the best way
> possible. So, I thought I'd ask the experts.
>
> What I want to do is set a property if at least one file in a
> directory tree contains a regular expression X. Here's what I'm
> doing:
>
> Create a fileset containing all files that match this condition:
> <fileset dir="WebInfra/Source" id="fileset" includes="**/*">
> <containsregexp expression="dg" />
> </fileset>
>
> Convert that fileset to a string that contains the filenames in the fileset:
> <pathconvert pathsep="--" property="files_path" refid="fileset" />
>
> Set the property if the filename string is longer then 0:
> <condition property="prop_from_condition" value="true">
> <length string="${files_path}" trim="true" when="greater" length="0" />
> </condition>
>
> So, is this the best way to set a property to true if a directory tree
> contains a file that matches a RegEx? Is there a better way?
>
> Thanks
>
> JDG
>
> PS: I'm limited by my current environment to ant 1.6.5.
>
> --
> Jay Dickon Glanville
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
--
David Weintraub
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]