Skip to content

Commit

Permalink
[neo-cli] Error Message and Warning - LevelDb (#3380)
Browse files Browse the repository at this point in the history
* Fixed warnings and error message for `libleveldb` missing

* Update src/Neo.CLI/CLI/MainService.cs

Co-authored-by: lingyido <lingyido@gmail.com>

---------

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: lingyido <lingyido@gmail.com>
Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
  • Loading branch information
4 people authored Jul 5, 2024
1 parent 2c20820 commit c537f87
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/Neo.CLI/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
using System.Net;
using System.Numerics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -383,7 +382,7 @@ public async void Start(CommandLineOptions options)
}
catch (DllNotFoundException ex) when (ex.Message.Contains("libleveldb"))
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
if (OperatingSystem.IsWindows())
{
if (File.Exists("libleveldb.dll"))
{
Expand All @@ -392,25 +391,32 @@ public async void Start(CommandLineOptions options)
}
else
{
DisplayError("DLL not found, please get libleveldb.dll.");
DisplayError("DLL not found, please get libleveldb.dll.",
"Download from https://github.com/neo-ngd/leveldb/releases");
}
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
else if (OperatingSystem.IsLinux())
{
DisplayError("Shared library libleveldb.so not found, please get libleveldb.so.",
"Use command \"sudo apt-get install libleveldb-dev\" in terminal or download from https://github.com/neo-ngd/leveldb/releases");
}
else if (OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst())
{
DisplayError("Shared library libleveldb.dylib not found, please get libleveldb.dylib.",
"From https://github.com/neo-project/neo/releases");
"Use command \"brew install leveldb\" in terminal or download from https://github.com/neo-ngd/leveldb/releases");
}
else
{
DisplayError("Neo CLI is broken, please reinstall it.",
"From https://github.com/neo-project/neo/releases");
"Download from https://github.com/neo-project/neo/releases");
}

return;
}
catch (DllNotFoundException)
{
DisplayError("Neo CLI is broken, please reinstall it.",
"From https://github.com/neo-project/neo/releases");
"Download from https://github.com/neo-project/neo/releases");
return;
}

NeoSystem.AddService(this);
Expand Down

0 comments on commit c537f87

Please sign in to comment.