Check if directory exists in Phing and prompt to continue?

Viewed 8898

I'm trying to check if a directory or file exists in Phing but I cannot even get the basics to work.

For example:

<project name="test" default="help" basedir="./">

<target name="clean" description="Deletes directory">

    <available file="/testy" type="dir" property="dir.Exists" />

        <if>
            <isset property="dir.Exists"/>
                <then>
                    <echo>Yep</echo>
                </then> 
        </if>

</target>

<phingcall target="clean" />

</project>

I get a weird error:

Error reading project file [wrapped: \build.xml:22:18: Error initializing nested  
element <echo> [wrapped: phing.tasks.system.IfTask doesn't support the 'echo' 
creator/adder.]]

Ultimately I wanted to add a conditional yes/no to proceed if a directory exists.

ps. The error has nothing to do with "nested element echo" as far as I can tell because if I remove the echo it still sends the same error, in fact I think this is a default syntax related error message or something.

1 Answers
Related