mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 12:44:16 +01:00
fix: only load latest version of a plugin, don't automatically re-enable plugins
This commit is contained in:
parent
465ae1857d
commit
5e31537a0c
1 changed files with 19 additions and 5 deletions
|
|
@ -307,6 +307,7 @@ internal partial class PluginManager : IDisposable, IServiceType
|
||||||
// Add installed plugins. These are expected to be in a specific format so we can look for exactly that.
|
// Add installed plugins. These are expected to be in a specific format so we can look for exactly that.
|
||||||
foreach (var pluginDir in this.pluginDirectory.GetDirectories())
|
foreach (var pluginDir in this.pluginDirectory.GetDirectories())
|
||||||
{
|
{
|
||||||
|
var versionsDefs = new List<PluginDef>();
|
||||||
foreach (var versionDir in pluginDir.GetDirectories())
|
foreach (var versionDir in pluginDir.GetDirectories())
|
||||||
{
|
{
|
||||||
var dllFile = new FileInfo(Path.Combine(versionDir.FullName, $"{pluginDir.Name}.dll"));
|
var dllFile = new FileInfo(Path.Combine(versionDir.FullName, $"{pluginDir.Name}.dll"));
|
||||||
|
|
@ -317,7 +318,16 @@ internal partial class PluginManager : IDisposable, IServiceType
|
||||||
|
|
||||||
var manifest = LocalPluginManifest.Load(manifestFile);
|
var manifest = LocalPluginManifest.Load(manifestFile);
|
||||||
|
|
||||||
pluginDefs.Add(new PluginDef(dllFile, manifest, false));
|
versionsDefs.Add(new PluginDef(dllFile, manifest, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pluginDefs.Add(versionsDefs.OrderByDescending(x => x.Manifest!.EffectiveVersion).First());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Couldn't choose best version for plugin: {Name}", pluginDir.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -712,11 +722,15 @@ internal partial class PluginManager : IDisposable, IServiceType
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (plugin.IsDisabled)
|
if (!plugin.IsDisabled)
|
||||||
plugin.Enable();
|
{
|
||||||
|
|
||||||
await plugin.LoadAsync(reason);
|
await plugin.LoadAsync(reason);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Verbose($"{name} was disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (InvalidPluginException)
|
catch (InvalidPluginException)
|
||||||
{
|
{
|
||||||
PluginLocations.Remove(plugin.AssemblyName?.FullName ?? string.Empty, out _);
|
PluginLocations.Remove(plugin.AssemblyName?.FullName ?? string.Empty, out _);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue