Skip to content

Commit

Permalink
create directory before lock file
Browse files Browse the repository at this point in the history
(cherry picked from commit 357b3db)
  • Loading branch information
EricBoiseLGSVL committed Jul 22, 2021
1 parent c28fb0d commit 6eef4e4
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions Assets/Scripts/Web/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ private static void Initialize()
if (!Application.isEditor)
{
ParseCommandLine();
}

CreatePersistentPath();

if (!Application.isEditor)
{
CreateLockFile();
}

Expand All @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6eef4e4

Please sign in to comment.