feat: also clean up latest plugin version if disabled

This commit is contained in:
goat 2021-04-28 18:01:45 +02:00
parent 6356ad53b9
commit 0b538c5db6
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -346,15 +346,15 @@ namespace Dalamud.Plugin
if (!success) { Log.Debug("Unparseable version: {0}", dirInfo.Name); } if (!success) { Log.Debug("Unparseable version: {0}", dirInfo.Name); }
return version; return version;
}).ToArray(); }).ToArray();
for (var i = 0; i < sortedVersions.Length - 1; i++) { for (var i = 0; i < sortedVersions.Length; i++) {
var disabledFile = new FileInfo(Path.Combine(sortedVersions[i].FullName, ".disabled")); var disabledFile = new FileInfo(Path.Combine(sortedVersions[i].FullName, ".disabled"));
if (disabledFile.Exists) { if (disabledFile.Exists) {
Log.Information("[PLUGINR] Trying to delete old {0} at {1}", installed.Name, sortedVersions[i].FullName); Log.Information("[PLUGINR] Trying to clean up {0} at {1}", installed.Name, sortedVersions[i].FullName);
try { try {
sortedVersions[i].Delete(true); sortedVersions[i].Delete(true);
} }
catch (Exception ex) { catch (Exception ex) {
Log.Error(ex, "[PLUGINR] Could not delete old version"); Log.Error(ex, $"[PLUGINR] Could not clean up {disabledFile.FullName}");
} }
} }
} }