Skip to content

Commit

Permalink
chg - Show path if library is not found
Browse files Browse the repository at this point in the history
---

Type: chg
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed May 16, 2024
1 parent 1e22b27 commit 860bac2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Magico.Native/Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal static void InitializeNative()
return;
string libPath = GetLibraryPath();
if (!File.Exists(libPath))
throw new Exception("Can't load magic library because it isn't found.");
throw new Exception($"Can't load magic library because it isn't found. Magic library was: {libPath}");
#if NETCOREAPP
NativeLibrary.SetDllImportResolver(typeof(Initializer).Assembly, ResolveLibrary);
#else
Expand Down Expand Up @@ -91,6 +91,7 @@ private static string GetLibraryPath()
return path;
}

#if !NETCOREAPP
private static string GetLibraryGnuRxPath()
{
var asm = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
Expand All @@ -105,6 +106,7 @@ private static string GetLibraryGnuRxPath()
string path = $"{execPath}{directory}{libName}";
return path;
}
#endif

#if NETCOREAPP
private static nint ResolveLibrary(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
Expand Down

0 comments on commit 860bac2

Please sign in to comment.