ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: newbie - if-then-else task?
Date Mon, 03 Dec 2001 19:58:05 GMT
You can use <available>. It doesn't "just set a flag" -- you can assign
any value to the property it's (potentially) setting, so have the value be
the path to the file it finds, then reference that property in your <copy>

If you can use a nightly build rather than a release, you can do this more
easily, since, if the local file was found and therefore the
filename-property was set to that, the second check (the one for the
system file) won't (now) overwrite the value of the filename-property. If
you need to use a release, you'll need to do it in a couple of more steps,
but it's still quite doable. 


--- Russ Fink <> wrote:
> Hello,
> I'm new at Ant and I will describe what I want to do -- followed with
> how I 
> hope to do it.
> I'm trying to copy files from two sources, a system directory followed
> by a 
> local directory.  This is prior to a build, and I'm modifying an
> existing 
> build file.  What I want is to copy a file from a system directory, and
> if a 
> file exists in a similar local structure, I want to copy that version. 
> Both 
> destinations are the same, i.e., a
> generated directory.
> I tried using the <copy> target to copy from the system location first,
> then 
> the local directory second, and the problem is that the build fails if
> it 
> doesn't find the file in the local directory.
> How I want to do this is to use conditional logic.  Basically, if the
> local 
> file exists, I want to use it, but if it doesn't exist, I want to use
> the 
> system copy.
> Questions.  Is this how you would do it?  If so, what is the method for 
> <if-then-else> or what can I use?
> I can't easily do this with <available>, since all that does is set a
> flag, 
> which apparently can only be used in the <target> line.  What I want is 
> within a target, being able to evaluate a tag and take some action.
> I'm open to suggestions - Thanks,
> Russ
> PS: the manual is very good, but it would be much better if there were
> an 
> index in it somewhat similar to Javadocs.
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> --
> To unsubscribe, e-mail:  
> <>
> For additional commands, e-mail:
> <>


Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message