This error occurs: /tmp/build2.xml:22: restrict doesn't support the nested "type" element.
<project name="main"> <macrodef name="assertDirs" backtrace="false"> <element name="rc" implicit="true" /> <sequential> <difference id="assertDirs.missing"> <rc /> <restrict> <rc /> <type type="dir" /> </restrict> </difference> <fail message="Missing ${toString:assertDirs.missing}"> <condition> <resourcecount when="gt" count="0" refid="assertDirs.missing" /> </condition> </fail> </sequential> </macrodef> <assertDirs> <filelist id="dirs" dir="${basedir}" files="bin,chat,client" /> </assertDirs> </project> -----Original Message----- From: Matt Benson [mailto:gudnabr...@yahoo.com] Sent: Thursday, April 09, 2009 4:21 PM To: Ant Users List Subject: Re: fail task if subdirectories do not exist. Here's a cool example if I do say so myself: <project> <macrodef name="assertDirs" backtrace="false"> <element name="rc" implicit="true" /> <sequential> <difference id="assertDirs.missing"> <rc /> <restrict> <rc /> <type type="dir" /> </restrict> </difference> <fail message="Missing ${toString:assertDirs.missing}"> <condition> <resourcecount when="gt" count="0" refid="assertDirs.missing" /> </condition> </fail> </sequential> </macrodef> <assertDirs> <filelist id="dirs" dir="${basedir}" files="bin,chat,client" /> </assertDirs> </project> Wrap that macrodef up and take it wherever you like! HTH, Matt --- On Thu, 4/9/09, Lucas Albers <smurfb...@hotmail.com> wrote: > From: Lucas Albers <smurfb...@hotmail.com> > Subject: fail task if subdirectories do not exist. > To: "'Ant Users List'" <user@ant.apache.org> > Date: Thursday, April 9, 2009, 4:35 PM > How can I a fail task for a directory > resource count? > I can see the syntax for failing if a file does not exists > as part of a > resource. > I do not know the syntax to fail if a directory that is > part of a resource > does not exist: > > See sample code: > > > Item 1: > <fail message="Files are missing."> > <condition> > <not> > <resourcecount > count="2"> > > <fileset id="fs" dir="." includes="one.txt,two.txt"/> > > </resourcecount> > </not> > </condition> > </fail> > > Item 2: > <fail message="missing dir: > bin"><condition><not><available > file="bin" > type="dir"/></not></condition></fail> > <fail message="missing dir: > chat"><condition><not><available > file="chat" > type="dir"/></not></condition></fail> > <fail message="missing dir: > client"><condition><not><available > file="client" > type="dir"/></not></condition></fail> > > > > How can I use a resource count to check for the existence > of subdirectories? > I can see how to it it by defining each one, and I would > prefer to check it > via a property value in a resourecount thingamabob. > > Thx. > > Ps: > I read the documentation but problem lies between keyboard > and chair. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org