summaryrefslogtreecommitdiff
path: root/qadevOOo/runner
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2005-11-02 16:43:18 +0000
committerKurt Zenker <kz@openoffice.org>2005-11-02 16:43:18 +0000
commita6aae258ce4ddb3ec68c815dbbb451a93f66d5b8 (patch)
treeb9441fd2a97e1dfe9751538503f7f813d36d26dd /qadevOOo/runner
parentbc8e26686f2b8b65c2143e7daa85b31295222f57 (diff)
INTEGRATION: CWS qadev24 (1.3.2); FILE MERGED
2005/10/04 10:41:51 lla 1.3.2.1: #i52275# better recursive directory cleaning software
Diffstat (limited to 'qadevOOo/runner')
-rw-r--r--qadevOOo/runner/helper/FileTools.java52
1 files changed, 36 insertions, 16 deletions
diff --git a/qadevOOo/runner/helper/FileTools.java b/qadevOOo/runner/helper/FileTools.java
index dc9c2e99081d..96e4285a0803 100644
--- a/qadevOOo/runner/helper/FileTools.java
+++ b/qadevOOo/runner/helper/FileTools.java
@@ -4,9 +4,9 @@
*
* $RCSfile: FileTools.java,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 17:19:03 $
+ * last change: $Author: kz $ $Date: 2005-11-02 17:43:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -131,10 +131,11 @@ public class FileTools {
*/
public static boolean deleteDir(File dir) {
- if (! cleanDir(dir)) return false;
+ // if (! cleanDir(dir)) return false;
// The directory is now empty so delete it
- return dir.delete();
+ // return dir.delete();
+ return cleanDir(dir);
}
/**
@@ -144,17 +145,36 @@ public class FileTools {
* @return Returns true if all deletions were successful, else false.
* @param dir the directory to clean from content
*/
- public static boolean cleanDir(File dir){
-
- boolean success = true;
- if (dir.isDirectory()){
- File [] theFiles = dir.listFiles();
-
- if (theFiles.length != 0 )
- for (int i = 0; i < theFiles.length; i++){
- success &= theFiles[i].delete();
+ // public static boolean cleanDir(File dir){
+ //
+ // boolean success = true;
+ // if (dir.isDirectory()){
+ // File [] theFiles = dir.listFiles();
+ //
+ // if (theFiles.length != 0 )
+ // for (int i = 0; i < theFiles.length; i++){
+ // success &= theFiles[i].delete();
+ // }
+ // }
+ // return success;
+ // }
+
+ public static boolean cleanDir(File dir)
+ {
+ if (dir.isDirectory())
+ {
+ String[] children = dir.list();
+ for (int i=0; i<children.length; i++)
+ {
+ boolean success = cleanDir(new File(dir, children[i]));
+ if (!success)
+ {
+ return false;
+ }
}
+ }
+
+ // The directory is now empty so delete it
+ return dir.delete();
}
- return success;
- }
-} \ No newline at end of file
+}