diff --git a/Assets/Scripts/Model/SquadBuilder/RandomSquads.cs b/Assets/Scripts/Model/SquadBuilder/RandomSquads.cs index 36643f3a3c..17727ffe25 100644 --- a/Assets/Scripts/Model/SquadBuilder/RandomSquads.cs +++ b/Assets/Scripts/Model/SquadBuilder/RandomSquads.cs @@ -28,7 +28,14 @@ public static void SetRandomAiSquad() private static JSONObject GetRandomAiSquad() { string oldDirectoryPath = Application.persistentDataPath + "/" + Edition.Current.Name + "/RandomAiSquadrons"; - if (Directory.Exists(oldDirectoryPath)) Directory.Move(oldDirectoryPath, oldDirectoryPath + "-IsNotUsedAnymore"); + try + { + if (Directory.Exists(oldDirectoryPath)) Directory.Move(oldDirectoryPath, oldDirectoryPath + "-IsNotUsedAnymore"); + } + catch + { + Messages.ShowError("Backup of old directory is failed: " + oldDirectoryPath); + } string directoryPathPrefix = Application.persistentDataPath + "/" + Edition.Current.Name + "/AiSquadrons"; if (!Directory.Exists(directoryPathPrefix)) Directory.CreateDirectory(directoryPathPrefix);