ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Delete.java
Date Wed, 14 Mar 2001 13:02:54 GMT
bodewig     01/03/14 05:02:53

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs Delete.java
  Log:
  Make <delete quite="true"> handle non-existing dirs in filesets gracefully.
  
  Suggested by:	Jon Stevens <jon@latchkey.com>
  
  Revision  Changes    Path
  1.88      +3 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- WHATSNEW	2001/03/14 12:48:26	1.87
  +++ WHATSNEW	2001/03/14 13:02:48	1.88
  @@ -33,6 +33,9 @@
     declaration time but will created before the fileset gets used for the
     first time.
   
  +* If the quiet attribute has been set, <delete> will handle <fileset>s
  +  with non-existing directories gracefully.
  +
   Changes from Ant 1.2 to Ant 1.3
   ===========================================
   
  
  
  
  1.17      +26 -8     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Delete.java
  
  Index: Delete.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Delete.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Delete.java	2001/03/14 12:28:24	1.16
  +++ Delete.java	2001/03/14 13:02:52	1.17
  @@ -268,18 +268,36 @@
           // delete the files in the filesets
           for (int i=0; i<filesets.size(); i++) {
               FileSet fs = (FileSet) filesets.elementAt(i);
  -            DirectoryScanner ds = fs.getDirectoryScanner(project);
  -            String[] files = ds.getIncludedFiles();
  -            String[] dirs = ds.getIncludedDirectories();
  -            removeFiles(fs.getDir(project), files, dirs);
  +            try {
  +                DirectoryScanner ds = fs.getDirectoryScanner(project);
  +                String[] files = ds.getIncludedFiles();
  +                String[] dirs = ds.getIncludedDirectories();
  +                removeFiles(fs.getDir(project), files, dirs);
  +            } catch (BuildException be) {
  +                // directory doesn't exist or is not readable
  +                if (!quiet) {
  +                    throw be;
  +                } else {
  +                    log(be.getMessage(), Project.MSG_VERBOSE);
  +                }
  +            }
           }
   
           // delete the files from the default fileset
           if (usedMatchingTask && dir != null) {
  -            DirectoryScanner ds = super.getDirectoryScanner(dir);
  -            String[] files = ds.getIncludedFiles();
  -            String[] dirs = ds.getIncludedDirectories();
  -            removeFiles(dir, files, dirs);
  +            try {
  +                DirectoryScanner ds = super.getDirectoryScanner(dir);
  +                String[] files = ds.getIncludedFiles();
  +                String[] dirs = ds.getIncludedDirectories();
  +                removeFiles(dir, files, dirs);
  +            } catch (BuildException be) {
  +                // directory doesn't exist or is not readable
  +                if (!quiet) {
  +                    throw be;
  +                } else {
  +                    log(be.getMessage(), Project.MSG_VERBOSE);
  +                }
  +            }
           }
       } 
   
  
  
  

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