On Wed, 21 Mar 2001 10:06:26 -0800, Steve Loughran wrote: > >----- Original Message ----- >From: "Stefan Bodewig" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Wednesday, March 21, 2001 02:46 >Subject: Re: <available> problem > > >> Vincent Massol <[EMAIL PROTECTED]> wrote: >> >> > Sorry but my requirement is simple : I just want to know if the file >> > exist. How can I do that in Ant ? If available is not the right >> > task, is there any other task that will do that ? I don't care >> > whether the basedir directory does exist or not ... >> >> I know that, just "" _is_ the basedir, sorry. >> >> > I prefer Steve's idea of having 2 attributes to the available task : >> > 'file' and 'dir'. File means testing if the file does exist and dir >> > means testing if the directory exists. At least the meaning is clear >> > and you add the ability to check whether a file does exist or not. >> >> Having file and dir only makes sense if we not only test the existance >> of a filesystem object, but also whether it is of the given type. If >> we introduce this change, we are sure going to break older builds, so >> it cannot happen in Ant 1.x. > >I was thinking that a 'fileonly=<file>' attribute could check for exists >(file) && !directory(file), a 'dir=<file>' checks for exists(dir) && >directory(file). Of course the immediate feature creep then becomes to check >for access permissions with conditions like readable='true' and >writeable='false'... >
In the culler stuff I just submitted there is an FileAttributeCuller that tests a file for all the various attributes. It seems to me a simple effort to add support for a fileset to available. Its would be true if the FileSet returns any (or perhaps N) files. d
