ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject Re: delete quiet=true
Date Mon, 12 Mar 2001 08:49:23 GMT
Jon,

From: "Jon Stevens" <jon@latchkey.com>
> I added the attribute quite=true to the <delete> task. When I checked in
> this code, it worked.
>
> However, I'm using Ant 1.3 and it is not working:
>
> I have:
>
>   <target name="package-zip"
>           depends="package"
>           description="--> generates the Turbine distribution as .zip">
>       <delete file="../${final.name}.zip" quiet="true"/>
>       <zip zipfile="../${final.name}.zip" basedir="../"
>            includes="**/${final.name}/**"/>
>   </target>
>
> I'm getting:
>
> package-zip:
>    [delete] Could not find file
> /Users/jon/checkout/jakarta-velocity/velocity-0.
> 75.zip to delete.
>       [zip] Building zip:
> /Users/jon/checkout/jakarta-velocity/velocity-0.75.zip
>
> What the heck?
>
> -jon

The change you made was to stop delete throwing an exception when
quiet=true. In effect quiet is a misnomer and it would perhaps have been
better named failonerror (you'd need to reverse the polarity, there, if you
know what I mean). You didn't actually make the task quiet, in the logging
sense.

Here is the code in question

        if (file != null) {
            if (file.exists()) {
                if (file.isDirectory()) {
                    log("Directory " + file.getAbsolutePath() + " cannot be
removed using the file attribute.  Use dir instead.");
                } else {
                    log("Deleting: " + file.getAbsolutePath());

                    if (!quiet && !file.delete()) {
                        throw new BuildException("Unable to delete file " +
file.getAbsolutePath());
                    }
                }
            } else {
------>>>>log("Could not find file " + file.getAbsolutePath() + " to
delete.");
            }
        }

I would suggest we make the log statement indicated at verbose level. I
can't imagine many people caring about not being able to delete a file that
doesn't exist. If you agree, I can make the change for you.

Conor



---------------------------------------------------------------------
To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: ant-dev-help@jakarta.apache.org


Mime
View raw message