ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Copydir.java
Date Thu, 03 Aug 2000 09:43:20 GMT
bodewig     00/08/03 02:43:18

  Modified:    docs     index.html
               src/main/org/apache/tools/ant/taskdefs Copydir.java
  Log:
  Added flatten attribute to <copydir>.
  Submitted by:	Jeff Martin <jeff.martin@synamic.co.uk>
  
  Revision  Changes    Path
  1.64      +7 -0      jakarta-ant/docs/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/index.html,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- index.html	2000/08/03 09:00:32	1.63
  +++ index.html	2000/08/03 09:43:17	1.64
  @@ -856,6 +856,13 @@
       <td valign="top" align="center">No</td>
     </tr>
     <tr>
  +    <td valign="top">flatten</td>
  +    <td valign="top">ignore directory structure of source directory,
  +      copy all files into a single directory - specified by the dest
  +      attribute (default is false).</td>
  +    <td valign="top" align="center">No</td>
  +  </tr>
  +  <tr>
       <td valign="top">forceoverwrite</td>
       <td valign="top">overwrite existing files even if the destination
         files are newer (default is false).</td>
  
  
  
  1.11      +11 -1     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java
  
  Index: Copydir.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Copydir.java	2000/07/06 16:48:13	1.10
  +++ Copydir.java	2000/08/03 09:43:18	1.11
  @@ -70,6 +70,7 @@
       private File srcDir;
       private File destDir;
       private boolean filtering = false;
  +    private boolean flatten = false;
       private boolean forceOverwrite = false;
       private Hashtable filecopyList = new Hashtable();
   
  @@ -85,6 +86,10 @@
           filtering = Project.toBoolean(filter);
       }
   
  +    public void setFlatten(boolean flatten) {
  +        this.flatten = flatten;
  +    }
  +
       public void setForceoverwrite(String force) {
           forceOverwrite = Project.toBoolean(force);
       }
  @@ -127,7 +132,12 @@
           for (int i = 0; i < files.length; i++) {
               String filename = files[i];
               File srcFile = new File(from, filename);
  -            File destFile = new File(to, filename);
  +            File destFile;
  +            if (flatten) {
  +                destFile = new File(to, new File(filename).getName());
  +            } else {
  +                destFile = new File(to, filename);
  +            }
               if (forceOverwrite ||
                   (srcFile.lastModified() > destFile.lastModified())) {
                   filecopyList.put(srcFile.getAbsolutePath(),
  
  
  

Mime
View raw message