ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1477998 - /ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java
Date Wed, 01 May 2013 13:40:01 GMT
Author: bramk
Date: Wed May  1 13:40:01 2013
New Revision: 1477998

URL: http://svn.apache.org/r1477998
Log:
ACE-346 Cleanup empty directories

Proactively remove directories left empty when a resource gets deleted to minimize the cost
of lastmodied checks.


Modified:
    ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java

Modified: ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java?rev=1477998&r1=1477997&r2=1477998&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java
(original)
+++ ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java
Wed May  1 13:40:01 2013
@@ -120,16 +120,18 @@ public class BundleFileStore implements 
 
     public boolean remove(String fileName) throws IOException {
         File file = createFile(fileName);
-
         if (file.exists()) {
             if (file.delete()) {
+                // deleting empty parent dirs
+                while ((file = file.getParentFile()) != null && !file.equals(m_dir)
&& file.list().length == 0) {
+                    file.delete();
+                }
                 return true;
             }
             else {
                 throw new IOException("Unable to delete file (" + file.getAbsolutePath()
+ ")");
             }
         }
-
         return false;
     }
 



Mime
View raw message