diff --git a/CustomizePlus/Configuration/Services/ConfigurationMigrator.cs b/CustomizePlus/Configuration/Services/ConfigurationMigrator.cs index e67d550..403f903 100644 --- a/CustomizePlus/Configuration/Services/ConfigurationMigrator.cs +++ b/CustomizePlus/Configuration/Services/ConfigurationMigrator.cs @@ -95,8 +95,8 @@ public class ConfigurationMigrator while (template.UniqueId == Guid.Empty || usedGuids.Contains(template.UniqueId)); usedGuids.Add(template.UniqueId); - _saveService.ImmediateSave(template); - _saveService.ImmediateSave(profile); + _saveService.ImmediateSaveSync(template); + _saveService.ImmediateSaveSync(profile); _logger.Debug($"Migrated v3 profile {legacyProfile.ProfileName} to profile {profile.UniqueId} and template {template.UniqueId}"); File.Delete(file); diff --git a/CustomizePlus/Profiles/ProfileFileSystem.cs b/CustomizePlus/Profiles/ProfileFileSystem.cs index cd67c22..a87127e 100644 --- a/CustomizePlus/Profiles/ProfileFileSystem.cs +++ b/CustomizePlus/Profiles/ProfileFileSystem.cs @@ -94,24 +94,15 @@ public class ProfileFileSystem : FileSystem, IDisposable, ISavable private void Reload() { - if (Load(new FileInfo(_saveService.FileNames.ProfileFileSystem), _profileManager.Profiles, ProfileToIdentifier, ProfileToName)) + if (!File.Exists(_saveService.FileNames.ProfileFileSystem)) { - var shouldReloadAgain = false; - - if (!File.Exists(_saveService.FileNames.ProfileFileSystem)) - shouldReloadAgain = true; - - _saveService.ImmediateSave(this); - - //this is a workaround for FileSystem's weird behavior where it doesn't load objects into itself if its file does not exist - if (shouldReloadAgain) - { - _logger.Debug("BUG WORKAROUND: reloading profile filesystem again"); - Reload(); - return; - } + _logger.Debug("WORKAROUND: saving filesystem file"); + _saveService.ImmediateSaveSync(this); } + if (Load(new FileInfo(_saveService.FileNames.ProfileFileSystem), _profileManager.Profiles, ProfileToIdentifier, ProfileToName)) + _saveService.ImmediateSave(this); + _logger.Debug("Reloaded profile filesystem."); } diff --git a/CustomizePlus/Templates/TemplateFileSystem.cs b/CustomizePlus/Templates/TemplateFileSystem.cs index b4c40ff..aa994a5 100644 --- a/CustomizePlus/Templates/TemplateFileSystem.cs +++ b/CustomizePlus/Templates/TemplateFileSystem.cs @@ -95,24 +95,16 @@ public sealed class TemplateFileSystem : FileSystem