mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 13:53:40 +01:00
feat(PluginRepo): delete empty installed folder when no versions (closes #339)
This commit is contained in:
parent
05347e65b1
commit
287cc0b84f
1 changed files with 14 additions and 5 deletions
|
|
@ -336,11 +336,6 @@ namespace Dalamud.Plugin
|
||||||
foreach (var installed in pluginsDirectory.GetDirectories()) {
|
foreach (var installed in pluginsDirectory.GetDirectories()) {
|
||||||
var versions = installed.GetDirectories();
|
var versions = installed.GetDirectories();
|
||||||
|
|
||||||
if (versions.Length == 0) {
|
|
||||||
Log.Information("[PLUGINR] Has no versions: {0}", installed.FullName);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sortedVersions = versions.OrderBy(dirInfo => {
|
var sortedVersions = versions.OrderBy(dirInfo => {
|
||||||
var success = Version.TryParse(dirInfo.Name, out Version version);
|
var success = Version.TryParse(dirInfo.Name, out Version version);
|
||||||
if (!success) { Log.Debug("Unparseable version: {0}", dirInfo.Name); }
|
if (!success) { Log.Debug("Unparseable version: {0}", dirInfo.Name); }
|
||||||
|
|
@ -381,6 +376,20 @@ namespace Dalamud.Plugin
|
||||||
{
|
{
|
||||||
Log.Error(ex, $"[PLUGINR] Could not clean up {version.FullName}");
|
Log.Error(ex, $"[PLUGINR] Could not clean up {version.FullName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (installed.GetDirectories().Length == 0)
|
||||||
|
{
|
||||||
|
Log.Information("[PLUGINR] Has no versions, cleaning up: {0}", installed.FullName);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
installed.Delete();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"[PLUGINR] Could not clean up {installed.FullName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue