mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-05 22:29:11 +01:00
Fix archive cleaner when no directory exists
This commit is contained in:
@@ -42,15 +42,17 @@ public class PluginArchiveCleaner {
|
||||
|
||||
public void cleanup(Path archivePath) throws IOException {
|
||||
|
||||
try (Stream<Path> pathStream = Files.list(archivePath)) {
|
||||
List<Path> pathList = pathStream
|
||||
.filter(PluginArchiveCleaner::isAnInstalledPluginDirectory)
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
if (Files.exists(archivePath)) {
|
||||
try (Stream<Path> pathStream = Files.list(archivePath)) {
|
||||
List<Path> pathList = pathStream
|
||||
.filter(PluginArchiveCleaner::isAnInstalledPluginDirectory)
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (int i = 0; i <= pathList.size() - MAX_ARCHIVE_COUNT; i++) {
|
||||
LOG.debug("Delete old installation directory {}", pathList.get(i));
|
||||
IOUtil.deleteSilently(pathList.get(i).toFile());
|
||||
for (int i = 0; i <= pathList.size() - MAX_ARCHIVE_COUNT; i++) {
|
||||
LOG.debug("Delete old installation directory {}", pathList.get(i));
|
||||
IOUtil.deleteSilently(pathList.get(i).toFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user