Core - Fixed crash on startup if workshop folder is missing

Updating - Properly delay auto-update check until the UI shows,
This commit is contained in:
Robert committed 2024-02-17 15:01:18 +01:00
1 parent cf10193bd2
commit 0b6bf5685e
9 files changed
+58 -32

No files matched your search

@@ -179,12 +179,26 @@ public class WorkshopService : IWorkshopService
{
if (_initialized)
throw new ArtemisWorkshopException("Workshop service is already initialized");
RemoveOrphanedFiles();
_pluginManagementService.AdditionalPluginDirectories.AddRange(GetInstalledEntries().Where(e => e.EntryType == EntryType.Plugin).Select(e => e.GetReleaseDirectory()));
_initialized = true;
try
{
if (!Directory.Exists(Constants.WorkshopFolder))
Directory.CreateDirectory(Constants.WorkshopFolder);
RemoveOrphanedFiles();
_pluginManagementService.AdditionalPluginDirectories.AddRange(GetInstalledEntries()
.Where(e => e.EntryType == EntryType.Plugin)
.Select(e => e.GetReleaseDirectory()));
_initialized = true;
}
catch (Exception e)
{
_logger.Error(e, "Failed to initialize workshop service");
}
}
private void RemoveOrphanedFiles()
{
List<InstalledEntry> entries = GetInstalledEntries();