Ant - testing for file existence with wildcards?
- From: "Andy Dingley <dingbat@xxxxxxxxxxxxxx>" <dingbat@xxxxxxxxxxxxxx>
- Date: 18 Jan 2007 08:47:07 -0800
As usual, I'm falling into the gaps of what <available> can't do.
I need to do two things:
- Determine if a directory has any unknown child directories, i.e. any
directories of any name, except a couple of pre-known excludes.
- Determine if a known directory has any contents, i.e. if matching a
wildcard is a non-empty set
What's the best way to do this, so I have a "once and for all" solution
to this recurring Ant problem?
<available> plain and simple doesn't work. It's not intended to, it
just "almost works" and so we've got into the habit of using it for
this task. If you use it strictly as "available", i.e. "Here's a known
thing, does it exist?" then it's OK.
I have used the following hack for the second, which works OK so long
as the directory exists. I have to wrap it in a vast pile of dependent
targets and test for the directory's existence first with <available>!
As I have to do this a dozen times, that's not attractive.
<pathconvert property="pt2-src-functions" setonempty="false"
pathsep=" " >
<path><fileset dir="${customer.db.dir}/functions"
includes="*.*" /></path>
</pathconvert>
I'm having no success at all with the first. 8-(
Ideally I want a solution that's based on "standard Ant" as much as
possible. I could write my own Java task pretty easily, but I have to
deploy and maintain this script worldwide. One of the reasons for using
Ant at all is that it's a pre-deployed common platform. Ha!
And _why_ doesn't <echo> support if and unless ? 8-(
Any assistance very gratefully received (beer, chocolate or noodles if
you're local to Bristol!)
.
- Follow-Ups:
- Re: Ant - testing for file existence with wildcards?
- From: Daniel Dyer
- Re: Ant - testing for file existence with wildcards?
- Prev by Date: Configuration of NetBeans and Tomcat
- Next by Date: Re: Ant - testing for file existence with wildcards?
- Previous by thread: Configuration of NetBeans and Tomcat
- Next by thread: Re: Ant - testing for file existence with wildcards?
- Index(es):