Fix .no_recover files never being cleaned up (fixes #497)

This commit is contained in:
Jonas Herzig
2021-08-15 11:28:11 +02:00
parent 110199044f
commit 3db8c28505
2 changed files with 17 additions and 1 deletions

View File

@@ -325,6 +325,18 @@ public class ReplayMod implements Module, Scheduler {
} catch (IOException e) {
e.printStackTrace();
}
// Cleanup leftover no_recover files
try (DirectoryStream<Path> paths = Files.newDirectoryStream(getReplayFolder())) {
for (Path path : paths) {
String name = path.getFileName().toString();
if (name.endsWith(".no_recover")) {
Files.delete(path);
}
}
} catch (IOException e) {
e.printStackTrace();
}
});
}