Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Fix inconsistency in plugin name #452

Merged
merged 11 commits into from
Dec 3, 2019
15 changes: 9 additions & 6 deletions neo-cli/Shell/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1250,19 +1250,22 @@ private bool OnUnInstallCommand(string[] args)
}

var pluginName = args[1];

if (!Plugin.Plugins.Any(u => u.Name == pluginName))
var plugin = Plugin.Plugins.FirstOrDefault(p => p.Name == pluginName);
if (plugin is null)
{
Console.WriteLine("Plugin not found");
return true;
}

if (Directory.Exists(Path.Combine("Plugins", pluginName)))
File.Delete(plugin.Path);
File.Delete(plugin.ConfigFile);
try
{
Directory.Delete(Path.GetDirectoryName(plugin.ConfigFile), false);
}
catch (IOException)
{
Directory.Delete(Path.Combine("Plugins", pluginName), true);
}

File.Delete(Path.Combine("Plugins", $"{pluginName}.dll"));
Console.WriteLine($"Uninstall successful, please restart neo-cli.");
return true;
}
Expand Down