diff --git a/Bloxstrap/JsonManager.cs b/Bloxstrap/JsonManager.cs index a713d4f..bb1eb77 100644 --- a/Bloxstrap/JsonManager.cs +++ b/Bloxstrap/JsonManager.cs @@ -47,6 +47,17 @@ namespace Bloxstrap if (!String.IsNullOrEmpty(message)) Frontend.ShowMessageBox($"{message}\n\n{ex.Message}", System.Windows.MessageBoxImage.Warning); + + try + { + // Create a backup of loaded file + File.Copy(FileLocation, FileLocation + ".bak", true); + } + catch (Exception copyEx) + { + App.Logger.WriteLine(LOG_IDENT, $"Failed to create backup file: {FileLocation}.bak"); + App.Logger.WriteException(LOG_IDENT, copyEx); + } } Save();