Do not bother recovering useless replays (fixes #444)
Useless replays being those for which auto-recording was disabled and Start never pressed.
This commit is contained in:
@@ -476,6 +476,14 @@ public class ReplayMod implements
|
||||
String name = path.getFileName().toString();
|
||||
if (name.endsWith(".mcpr.tmp") && Files.isDirectory(path)) {
|
||||
Path original = path.resolveSibling(FilenameUtils.getBaseName(name));
|
||||
Path noRecoverMarker = original.resolveSibling(original.getFileName() + ".no_recover");
|
||||
if (Files.exists(noRecoverMarker)) {
|
||||
// This file, when its markers are processed, doesn't actually result in any replays.
|
||||
// So we don't really need to recover it either, let's just get rid of it.
|
||||
FileUtils.deleteDirectory(path.toFile());
|
||||
Files.delete(noRecoverMarker);
|
||||
continue;
|
||||
}
|
||||
new RestoreReplayGui(this, GuiScreen.wrap(mc.currentScreen), original.toFile()).display();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,6 +272,10 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
// Immediately close the saving popup, the user doesn't care about it
|
||||
core.runLater(guiSavingReplay::close);
|
||||
|
||||
// If we crash right here, on the next start we'll prompt the user for recovery
|
||||
// but we don't really want that, so drop a marker file to skip recovery for this replay.
|
||||
Files.createFile(outputPath.resolveSibling(outputPath.getFileName() + ".no_recover"));
|
||||
|
||||
// We still have the replay, so we just save it (at least for a few weeks) in case they change their mind
|
||||
String replayName = FilenameUtils.getBaseName(outputPath.getFileName().toString());
|
||||
Path rawFolder = ReplayMod.instance.getRawReplayFolder();
|
||||
|
||||
Reference in New Issue
Block a user