You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2001/07/04 16:40:30 UTC

cvs commit: jakarta-ant/src/main/org/apache/tools/ant Project.java

bodewig     01/07/04 07:40:29

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant Project.java
  Log:
  delete existing target files before copying - this avoids overwriting
  symlinks and is consistent with Unix's cp(1).
  
  PR: 624
  Submitted by:	ederksen@arrow.lz.att.com (Enno Derksen)
  
  Revision  Changes    Path
  1.118     +3 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- WHATSNEW	2001/07/04 10:33:23	1.117
  +++ WHATSNEW	2001/07/04 14:40:25	1.118
  @@ -139,6 +139,9 @@
   * <jjtree>'s uptodate test works even if outputdirectory is not the
     parent dir of target
   
  +* <copy> will remove target file (if it exists) before writing to it -
  +  this avoids problems with links on filesystems that support them.
  +
   Changes from Ant 1.2 to Ant 1.3
   ===========================================
   
  
  
  
  1.60      +6 -1      jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- Project.java	2001/06/26 13:42:11	1.59
  +++ Project.java	2001/07/04 14:40:28	1.60
  @@ -752,8 +752,13 @@
                            boolean overwrite, boolean preserveLastModified)
           throws IOException {
           
  -        if (overwrite ||
  +        if (overwrite || !destFile.exists() ||
               destFile.lastModified() < sourceFile.lastModified()) {
  +
  +            if (destFile.exists()) {
  +                destFile.delete();
  +            }
  +
               log("Copy: " + sourceFile.getAbsolutePath() + " -> "
                       + destFile.getAbsolutePath(), MSG_VERBOSE);