ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fred Hauschel" <fred.hausc...@fiducia.de>
Subject target - if
Date Wed, 02 Apr 2003 11:46:47 GMT
Hey all,
i want to check if a directory exists, before execute an task.
Here is my build.xml:

<project name="bv_ewu" basedir="." default="run">
    <target name="run">
        <antcall target="prepare"/>
        <antcall target="home_available"/>
        <antcall target="rename_home"/>
    </target>

    <!-- Check timestamp on files -->
    <target name="prepare">
        <tstamp/>
    </target>

    <target name="home_available">
        <available property="exists" file="C:\home" type="dir" />
        <echo message="###homeAvailable${exists} "/>
    </target>

    <target name="rename_home" if="exists">
        <echo message="###homeAvailable${exists} "/>
    </target>

</project>

And thats the output:

Buildfile: build.xml

run:

prepare:

home_available:
     [echo] ###homeAvailabletrue

rename_home:

BUILD SUCCESSFUL
Total time: 3 seconds

So the property "exists" semms only to exists inside the target, but not 
in other targets !
But if i declare the property like this:
<property name="exists" value=""/>
it always exists !!

How can i use the "if" ????

Thanks Fredy
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message