From 51f2fe35a43a532bb0d3b169ef7c7e9aadb79e6f Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 25 Mar 2022 19:25:07 -0700 Subject: [PATCH] Trycatch backup file creation Stop putting PKHeX in Program Files ya goofballs --- PKHeX.WinForms/MainWindow/Main.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 99330f53e..5dce80805 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -824,7 +824,17 @@ private static bool TryBackupExportCheck(SaveFile sav, string path) { var src = sav.Metadata.FilePath; if (src is { } x && File.Exists(x)) - File.Copy(x, backupName); + { + try + { + File.Copy(x, backupName); + } + catch (Exception ex) + { + WinFormsUtil.Error(MsgBackupUnable, ex); + return false; + } + } } if (!FileUtil.IsFileLocked(path)) return true;