Skip to content

Commit

Permalink
- delete modern search index directory when not in use
Browse files Browse the repository at this point in the history
  • Loading branch information
derreisende77 committed Sep 24, 2024
1 parent c4f098b commit 07e9078
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/mediathek/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,31 @@ public static void main(final String... args) {
.getBoolean(ApplicationConfiguration.APPLICATION_USE_MODERN_SEARCH, false);
if (useModernSearch)
Daten.getInstance().setListeFilmeNachBlackList(new IndexedFilmList());
else {
try {
checkModernSearchIndexRemoval();
} catch (IOException e) {
logger.error("Unable to delete lucene index path", e);
}
}

startGuiMode();
});
}

/**
* Remove modern search index when not in use.
* @throws IOException
*/
private static void checkModernSearchIndexRemoval() throws IOException {
//when modern search is not in use, delete unused film index directory as a precaution
var indexPath = StandardLocations.getFilmIndexPath();
if (Files.exists(indexPath)) {
logger.info("Modern search not in use, deleting unnecessary index directory");
FileUtils.deletePathRecursively(indexPath);
}
}

/**
* Checks if the application has an debugger attached to it.
*
Expand Down

0 comments on commit 07e9078

Please sign in to comment.