Add error screen when renaming a replay fails
This commit is contained in:
@@ -3,6 +3,7 @@ package eu.crushedpixel.replaymod.gui.replayviewer;
|
||||
import eu.crushedpixel.replaymod.utils.ReplayFile;
|
||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiErrorScreen;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -54,7 +55,16 @@ public class GuiRenameReplay extends GuiScreen {
|
||||
|
||||
File initRenamed = new File(folder, (this.replayNameInput.getText().trim() + ReplayFile.ZIP_FILE_EXTENSION).replaceAll("[^a-zA-Z0-9\\.\\- ]", "_"));
|
||||
File renamed = ReplayFileIO.getNextFreeFile(initRenamed);
|
||||
FileUtils.moveFile(file, renamed);
|
||||
try {
|
||||
FileUtils.moveFile(file, renamed);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
mc.displayGuiScreen(new GuiErrorScreen(
|
||||
I18n.format("replaymod.gui.viewer.delete.failed1"),
|
||||
I18n.format("replaymod.gui.viewer.delete.failed2")
|
||||
));
|
||||
return;
|
||||
}
|
||||
this.mc.displayGuiScreen(this.parent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,8 @@ replaymod.gui.viewer.noauth=Log in to upload a Replay
|
||||
replaymod.gui.viewer.alreadyuploaded=This Replay has already been uploaded
|
||||
|
||||
replaymod.gui.viewer.delete.linea=Are you sure you want to delete this replay?
|
||||
replaymod.gui.viewer.delete.failed1=Your OS did not allow us to move the replay. There is
|
||||
replaymod.gui.viewer.delete.failed2=nothing we can do about this. You have to do it yourself.
|
||||
|
||||
#The Replay file name is inserted before the following string, e.g. "Some Replay will be lost forever!..."
|
||||
replaymod.gui.viewer.delete.lineb=will be lost forever! (a long time!)
|
||||
|
||||
Reference in New Issue
Block a user