mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
Merge pull request #262 from Aireil/fix_misc_plugin_update
Fix update behavior for testing and outdated plugins
This commit is contained in:
commit
ca2ce47d5d
2 changed files with 17 additions and 7 deletions
|
|
@ -256,7 +256,6 @@ namespace Dalamud.Plugin
|
|||
|
||||
if (pluginDef.DalamudApiLevel < DALAMUD_API_LEVEL) {
|
||||
Log.Error("Incompatible API level: {0}", dllFile.FullName);
|
||||
disabledFile.Create().Close();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,7 +192,19 @@ namespace Dalamud.Plugin
|
|||
});
|
||||
var latest = sortedVersions.Last();
|
||||
|
||||
if (File.Exists(Path.Combine(latest.FullName, ".disabled")) && !File.Exists(Path.Combine(latest.FullName, ".testing"))) {
|
||||
var isEnabled = !File.Exists(Path.Combine(latest.FullName, ".disabled"));
|
||||
if (!isEnabled && File.Exists(Path.Combine(latest.FullName, ".testing"))) {
|
||||
// In case testing is installed, but stable is enabled
|
||||
foreach (var version in versions) {
|
||||
if (!File.Exists(Path.Combine(version.FullName, ".disabled"))) {
|
||||
isEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEnabled) {
|
||||
Log.Verbose("Is disabled: {0}", installed.FullName);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -234,15 +246,14 @@ namespace Dalamud.Plugin
|
|||
// with an exception if we try to do it twice in row like this
|
||||
|
||||
if (!dryRun) {
|
||||
var wasEnabled =
|
||||
var wasLoaded =
|
||||
this.dalamud.PluginManager.Plugins.Where(x => x.Definition != null).Any(
|
||||
x => x.Definition.InternalName == info.InternalName);
|
||||
;
|
||||
|
||||
Log.Verbose("wasEnabled: {0}", wasEnabled);
|
||||
Log.Verbose("isEnabled: {0} / wasLoaded: {1}", isEnabled, wasLoaded);
|
||||
|
||||
// Try to disable plugin if it is loaded
|
||||
if (wasEnabled) {
|
||||
if (wasLoaded) {
|
||||
try {
|
||||
this.dalamud.PluginManager.DisablePlugin(info);
|
||||
}
|
||||
|
|
@ -264,7 +275,7 @@ namespace Dalamud.Plugin
|
|||
Log.Error(ex, "Plugin disable old versions failed");
|
||||
}
|
||||
|
||||
var installSuccess = InstallPlugin(remoteInfo, wasEnabled, true, testingAvailable);
|
||||
var installSuccess = InstallPlugin(remoteInfo, isEnabled, true, testingAvailable);
|
||||
|
||||
if (!installSuccess) {
|
||||
Log.Error("InstallPlugin failed.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue