ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: Multiple directory existence checking
Date Tue, 11 May 2004 16:27:47 GMT
Dominique Devienne wrote:

>>From: Rhino [mailto:rhino1@sympatico.ca]
>>I may give this a try myself but I thought I'd post this first to minimize
>>the time you have to wait for a suggestion. If I get my experiment to
>>work, I'll post the technique.
>>    
>>
>
>Something along the lines of (untested):
>
><condition property="all there">
>  <and>
>    <available file="${root}/dir1" type="dir" />
>    <available file="${root}/dir2" type="dir" />
>    <available file="${root}/dir3" type="dir" />
>  </and>
></condition>
>  
>
This works fine if you know the directories.
If you do not (directories are in a property), you need to
use something like the ant-contrib for task:
<project xmlns:ac="antlib:net.sf.antcontrib">
  <property name="root" location="src"/>
  <property name="subdirs" value="a:b:c:d"/>
  <target name="check.allpresent">
    <ac:for list="${subdirs}" delimiter=":" param="dir">
       <ac:sequential>
          <condition property="not.all.there">
             <not>
               <available file="${root}/@{dir}" type="dir"/>
             </not>
          </condition>
      </ac:sequential>
    </ac:for>
  </target>
  <target name="dothetask" depends="check.allpresent" 
unless="not.all.there">
    ...
  </target>
</project>

Peter

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


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


Mime
View raw message