diff src/goodjava/lucene/logging/LoggingIndexWriter.java @ 1475:c7b86342857f

more IoUtils
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 18 Apr 2020 11:02:18 -0600
parents 6c6ce14db6a8
children 7d145095cc0b
line wrap: on
line diff
--- a/src/goodjava/lucene/logging/LoggingIndexWriter.java	Fri Apr 17 21:53:09 2020 -0600
+++ b/src/goodjava/lucene/logging/LoggingIndexWriter.java	Sat Apr 18 11:02:18 2020 -0600
@@ -123,20 +123,11 @@
 		}
 		for( File f : logDir.listFiles() ) {
 			if( !used.contains(f.getName()) ) {
-				deleteFile(f);
+				IoUtils.deleteRecursively(f);
 			}
 		}
 	}
 
-	private static void deleteFile(File file) throws IOException {
-		if( file.isDirectory() ) {
-			for( File f : file.listFiles() ) {
-				deleteFile(f);
-			}
-		}
-		IoUtils.delete(file);
-	}
-
 	private void writeIndex() throws IOException {
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 		DataOutputStream dos = new DataOutputStream(baos);
@@ -218,7 +209,7 @@
 			System.exit(-1);
 		}
 		checkWriter.close();
-		deleteFile(dirFile);
+		IoUtils.deleteRecursively(dirFile);
 	}
 
 	private LogFile log() {