You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Darryl L. Miles" <da...@netbauds.net> on 2005/09/09 11:23:17 UTC
Condition operation based on existance of a file ?
How can I instruct ANT to conditionally do something, like a regular
if() statement.
Here is what I have so far (the unzip is my conditional operation):
<available file="${toplevel.dir}/${Name}.jar" property="doMerge"/>
<!-- IF doMerge -->
<unzip src="${toplevel.dir}/${Name}.jar" dest="${dist.dir}">
<patternset>
<include name="**/*"/>
</patternset>
</unzip>
<!-- ENDIF -->
Thanks
--
Darryl L. Miles
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Condition operation based on existance of a file ?
Posted by Moran Ben-David <mo...@place-base.com>.
You could use the <condition> task to set a variable with <available> as a
subtask within it.
Then actually do the control-flow check in a target's "if" or "unless"
attribute.
moran
> -----Original Message-----
> From: Darryl L. Miles [mailto:darryl@netbauds.net]
> Sent: Friday, September 09, 2005 5:23 AM
> To: user@ant.apache.org
> Subject: Condition operation based on existance of a file ?
>
>
> How can I instruct ANT to conditionally do something, like a regular
> if() statement.
>
> Here is what I have so far (the unzip is my conditional operation):
>
> <available file="${toplevel.dir}/${Name}.jar" property="doMerge"/>
> <!-- IF doMerge -->
> <unzip src="${toplevel.dir}/${Name}.jar" dest="${dist.dir}">
> <patternset>
> <include name="**/*"/>
> </patternset>
> </unzip>
> <!-- ENDIF -->
>
> Thanks
>
> --
> Darryl L. Miles
>
>
>
> ---------------------------------------------------------------------
> 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