Add try-catch for File.copy

This commit is contained in:
MrT 2024-12-12 20:03:03 +01:00
parent cfece3f1b9
commit a1e3e7b251
No known key found for this signature in database
GPG Key ID: 625DF880F57AC5E5

View File

@ -49,7 +49,14 @@ namespace Bloxstrap
Frontend.ShowMessageBox($"{message}\n\n{ex.Message}", System.Windows.MessageBoxImage.Warning);
// Create a backup of loaded file
File.Copy(FileLocation, FileLocation + ".bak");
try
{
File.Copy(FileLocation, FileLocation + ".bak");
}
catch
{
App.Logger.WriteLine(LOG_IDENT, "Backup file attempted to be created but failed. Please create a issue.");
}
}
Save();