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: [PATCH] copy with overwrite
Date Tue, 13 Feb 2001 10:42:35 GMT
Don,

Currently, overwrite means to overwrite the file even if the destination
file is newer, not to overwrite it at all costs. I am a little wary about
overwriting read-only files. How do other people feel about this?

Conor

----- Original Message -----
From: "Don Ferguson" <don@bea.com>
To: <ant-dev@jakarta.apache.org>
Sent: Tuesday, February 13, 2001 11:41 AM
Subject: [PATCH] copy with overwrite


> Under NT, attempts to copy over a read-only file raises a
> java.io.FileNotFoundException, even with the overwrite flag
> on.  This patch causes the file to first be deleted if overwrite
> is true, and if the destination file cannot be written.
>


---------------------------------------------------------------------------
-----


> Index: Project.java
> ===================================================================
> RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
> retrieving revision 1.53
> diff -c -r1.53 Project.java
> *** Project.java 2001/02/03 14:45:07 1.53
> --- Project.java 2001/02/13 00:23:19
> ***************
> *** 749,754 ****
> --- 749,758 ----
>                   parent.mkdirs();
>               }
>
> +             if (overwrite && !destFile.canWrite()) {
> +               destFile.delete();
> +             }
> +
>               if (filtering) {
>                   BufferedReader in = new BufferedReader(new
FileReader(sourceFile));
>                   BufferedWriter out = new BufferedWriter(new
FileWriter(destFile));
>
>


---------------------------------------------------------------------------
-----


> ---------------------------------------------------------------------
> 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