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

Commit

Permalink
Fix inconsistency in plugin name (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
superboyiii authored and erikzhang committed Dec 3, 2019
1 parent 517756c commit 15e52a0
Showing 1 changed file with 9 additions and 6 deletions.
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

0 comments on commit 15e52a0

Please sign in to comment.