delete parent dir only if it is empty, beacuse maybe several indexes can be contained in same parent dir
@@ -372,9 +372,16 @@ public abstract class OLuceneIndexEngineAbstract extends OSharedResourceAdaptive
FileSystems.getDefault().getPath(indexDir.getCanonicalPath()))){
break;
}
+ //delete only if dir is empty, otherwise stop deleting process
+ //last index will remove all upper dirs
+ if (indexDir.listFiles().length == 0){
OFileUtils.deleteRecursively(indexDir, true);
indexDir = indexDir.getParentFile();
}
+ else{
+ break;
+ }
+ }
}
}
