Split replay folder and file management into their own classes
This commit is contained in:
@@ -154,7 +154,7 @@ public class GuiSavingReplay {
|
||||
}
|
||||
|
||||
try {
|
||||
Path replaysFolder = core.getReplayFolder();
|
||||
Path replaysFolder = core.folders.getReplayFolder();
|
||||
Path newPath = replaysFolder.resolve(Utils.replayNameToFileName(newName));
|
||||
for (int i = 1; Files.exists(newPath); i++) {
|
||||
newPath = replaysFolder.resolve(Utils.replayNameToFileName(newName + " (" + i + ")"));
|
||||
|
||||
@@ -127,8 +127,8 @@ public class ConnectionEventHandler {
|
||||
}
|
||||
|
||||
String name = sdf.format(Calendar.getInstance().getTime());
|
||||
Path outputPath = core.getRecordingFolder().resolve(Utils.replayNameToFileName(name));
|
||||
ReplayFile replayFile = core.openReplay(outputPath);
|
||||
Path outputPath = core.folders.getRecordingFolder().resolve(Utils.replayNameToFileName(name));
|
||||
ReplayFile replayFile = core.files.open(outputPath);
|
||||
|
||||
replayFile.writeModInfo(ModCompat.getInstalledNetworkMods());
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
|
||||
// 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();
|
||||
Path rawFolder = ReplayMod.instance.folders.getRawReplayFolder();
|
||||
Path rawPath = rawFolder.resolve(outputPath.getFileName());
|
||||
for (int i = 1; Files.exists(rawPath); i++) {
|
||||
rawPath = rawPath.resolveSibling(replayName + "." + i + ".mcpr");
|
||||
|
||||
Reference in New Issue
Block a user