Merge pull request #414 from daemitus/fix_devplugin

This commit is contained in:
goaaats 2021-07-16 22:19:36 +02:00 committed by GitHub
commit 68142da426
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 26 deletions

View file

@ -33,18 +33,12 @@ namespace Dalamud.Plugin.Internal
public LocalDevPlugin(Dalamud dalamud, FileInfo dllFile, LocalPluginManifest manifest)
: base(dalamud, dllFile, manifest)
{
// base is called first, ensuring that this is a valid plugin assembly
var devSettings = dalamud.Configuration.DevPluginSettings.FirstOrDefault(cfg => cfg.DllFile == dllFile.FullName);
if (devSettings == default)
if (!dalamud.Configuration.DevPluginSettings.TryGetValue(dllFile.FullName, out this.devSettings))
{
devSettings = new DevPluginSettings(dllFile.FullName);
dalamud.Configuration.DevPluginSettings.Add(devSettings);
dalamud.Configuration.DevPluginSettings[dllFile.FullName] = this.devSettings = new DevPluginSettings();
dalamud.Configuration.Save();
}
this.devSettings = devSettings;
if (this.AutomaticReload)
{
this.EnableReloading();

View file

@ -455,6 +455,10 @@ namespace Dalamud.Plugin.Internal
var devPlugin = new LocalDevPlugin(this.dalamud, dllFile, manifest);
loadPlugin &= !isBoot || devPlugin.StartOnBoot;
// If we're not loading it, make sure it's disabled
if (!loadPlugin && !devPlugin.IsDisabled)
devPlugin.Disable();
plugin = devPlugin;
}
else
@ -479,14 +483,17 @@ namespace Dalamud.Plugin.Internal
}
catch (Exception ex)
{
// Dev plugins always get added to the list so they can be fiddled with in the UI
if (plugin.IsDev)
{
// Dev plugins always get added to the list so they can be fiddled with in the UI
Log.Information(ex, $"Dev plugin failed to load, adding anyways: {dllFile.Name}");
plugin.Disable(); // Disable here, otherwise you can't enable+load later
}
else if (plugin.Manifest.DalamudApiLevel < DalamudApiLevel)
{
// Out of date plugins get added so they can be updated.
Log.Information(ex, $"Plugin was outdated, adding anyways: {dllFile.Name}");
// plugin.Disable(); // Don't disable, or it gets deleted next boot.
}
else
{