From 2e2a63b89e178d606ed22a13bb5e8f5e8590a78d Mon Sep 17 00:00:00 2001 From: goat Date: Tue, 20 Jun 2023 20:35:00 +0200 Subject: [PATCH] fix: preserve legacy disabled state when loading a devplugin for the first time --- Dalamud/Plugin/Internal/PluginManager.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index 4558aefcb..e3c442473 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -694,6 +694,8 @@ internal partial class PluginManager : IDisposable, IServiceType { if (!setting.IsEnabled) continue; + + Log.Verbose("Scanning dev plugins at {Path}", setting.Path); if (Directory.Exists(setting.Path)) { @@ -1279,33 +1281,38 @@ internal partial class PluginManager : IDisposable, IServiceType var wantsInDefaultProfile = this.profileManager.DefaultProfile.WantsPlugin(probablyInternalNameForThisPurpose); - var wantsInAnyProfile = this.profileManager.GetWantState(probablyInternalNameForThisPurpose, false, false); if (wantsInDefaultProfile == null) { // We don't know about this plugin, so we don't want to do anything here. // The code below will take care of it and add it with the default value. - if (!wantsInAnyProfile) - loadPlugin = false; } else if (wantsInDefaultProfile == false && devPlugin.StartOnBoot) { // We didn't want this plugin, and StartOnBoot is on. That means we don't want it and it should stay off until manually enabled. + Log.Verbose("DevPlugin {Name} disabled and StartOnBoot => disable", probablyInternalNameForThisPurpose); this.profileManager.DefaultProfile.AddOrUpdate(probablyInternalNameForThisPurpose, false, false); + loadPlugin = false; } else if (wantsInDefaultProfile == true && devPlugin.StartOnBoot) { // We wanted this plugin, and StartOnBoot is on. That means we actually do want it. + Log.Verbose("DevPlugin {Name} enabled and StartOnBoot => enable", probablyInternalNameForThisPurpose); this.profileManager.DefaultProfile.AddOrUpdate(probablyInternalNameForThisPurpose, true, false); + loadPlugin = !doNotLoad; } else if (wantsInDefaultProfile == true && !devPlugin.StartOnBoot) { // We wanted this plugin, but StartOnBoot is off. This means we don't want it anymore. + Log.Verbose("DevPlugin {Name} enabled and !StartOnBoot => disable", probablyInternalNameForThisPurpose); this.profileManager.DefaultProfile.AddOrUpdate(probablyInternalNameForThisPurpose, false, false); + loadPlugin = false; } else if (wantsInDefaultProfile == false && !devPlugin.StartOnBoot) { // We didn't want this plugin, and StartOnBoot is off. We don't want it. + Log.Verbose("DevPlugin {Name} disabled and !StartOnBoot => disable", probablyInternalNameForThisPurpose); this.profileManager.DefaultProfile.AddOrUpdate(probablyInternalNameForThisPurpose, false, false); + loadPlugin = false; } plugin = devPlugin;