From 6eef4e49bfecf7cb8c8d7a8fd414003c5d03efa6 Mon Sep 17 00:00:00 2001 From: "eric.boise" Date: Thu, 22 Jul 2021 15:10:51 -0700 Subject: [PATCH] create directory before lock file (cherry picked from commit 357b3db0e1c2d171d049138bac4fb5309d57882d) --- Assets/Scripts/Web/Config.cs | 43 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/Assets/Scripts/Web/Config.cs b/Assets/Scripts/Web/Config.cs index b9bf421a1..2609581b6 100644 --- a/Assets/Scripts/Web/Config.cs +++ b/Assets/Scripts/Web/Config.cs @@ -95,6 +95,12 @@ private static void Initialize() if (!Application.isEditor) { ParseCommandLine(); + } + + CreatePersistentPath(); + + if (!Application.isEditor) + { CreateLockFile(); } @@ -107,23 +113,6 @@ private static void Initialize() LoadExternalAssets(); Sensors = SensorTypes.ListSensorFields(SensorPrefabs); - if (!Directory.Exists(PersistentDataPath)) - { - try - { - Directory.CreateDirectory(PersistentDataPath); - } - catch - { - Debug.LogError($"Cannot create directory at {PersistentDataPath}"); -#if UNITY_EDITOR - UnityEditor.EditorApplication.isPlaying = false; -#else - Application.Quit(1); -#endif - } - } - DatabaseManager.Init(); ClientSettingsService csservice = new ClientSettingsService(); @@ -777,6 +766,26 @@ private static void ParseCommandLine() } } + static void CreatePersistentPath() + { + if (!Directory.Exists(PersistentDataPath)) + { + try + { + Directory.CreateDirectory(PersistentDataPath); + } + catch + { + Debug.LogError($"Cannot create directory at {PersistentDataPath}"); +#if UNITY_EDITOR + UnityEditor.EditorApplication.isPlaying = false; +#else + Application.Quit(1); +#endif + } + } + } + static void CreateLockFile() { try