diff --git a/PKHeX.Core/Util/MessageStrings.cs b/PKHeX.Core/Util/MessageStrings.cs index 49c7aa88d..db7c1118d 100644 --- a/PKHeX.Core/Util/MessageStrings.cs +++ b/PKHeX.Core/Util/MessageStrings.cs @@ -136,6 +136,7 @@ public static class MessageStrings public static string MsgSaveSlotBadData { get; set; } = "Unable to set to this slot."; public static string MsgSaveBackup { get; set; } = "Saved Backup of current SAV to:"; + public static string MsgSaveBackupNotFound { get; set; } = "Original file has been moved; unable to copy a backup."; public static string MsgSaveCurrentGeneration { get; set; } = "Current SAV Generation: {0}"; public static string MsgSaveBoxCloneFromTabs { get; set; } = "Clone Pokemon from Editing Tabs to all slots in {0}?"; diff --git a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs index f4f887e5a..f2e80314b 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs @@ -783,11 +783,24 @@ public bool ExportBackup() { if (!SAV.State.Exportable || SAV.Metadata.FilePath is not { } file) return false; - using var sfd = new SaveFileDialog {FileName = Util.CleanFileName(SAV.Metadata.BAKName)}; + + if (!File.Exists(file)) + { + WinFormsUtil.Error(MsgSaveBackupNotFound, file); + return false; + } + + var suggestion = Util.CleanFileName(SAV.Metadata.BAKName); + using var sfd = new SaveFileDialog {FileName = suggestion}; if (sfd.ShowDialog() != DialogResult.OK) return false; string path = sfd.FileName; + if (!File.Exists(file)) // did they move it again? + { + WinFormsUtil.Error(MsgSaveBackupNotFound, file); + return false; + } File.Copy(file, path); WinFormsUtil.Alert(MsgSaveBackup, path);