Skip to content

Commit

Permalink
Merge pull request ikvmnet#576 from Fabian-Schmidt/Assembly_Location_…
Browse files Browse the repository at this point in the history
…empty_string

`Assembly.Location` might return an empty string.
  • Loading branch information
wasabii authored Aug 16, 2024
2 parents 2460b67 + b8b0c1e commit db67e8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/LibIkvm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static nint Load()
return h1;

// start looking at assembly path, or path given by environmental variable
var asml = typeof(NativeLibrary).Assembly.Location is string s ? Path.GetDirectoryName(s) : null;
var asml = typeof(NativeLibrary).Assembly.Location is string s && !string.IsNullOrEmpty(s) ? Path.GetDirectoryName(s) : null;
var root = Environment.GetEnvironmentVariable("IKVM_LIBRARY_PATH") ?? asml ?? AppContext.BaseDirectory;

// assembly possible loaded in memory: we have no available search path
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/NativeLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static NativeLibraryHandle Load(string nameOrPath)
return h1;

// start looking at assembly path, or path given by environmental variable
var asml = typeof(NativeLibrary).Assembly.Location is string s ? Path.GetDirectoryName(s) : null;
var asml = typeof(NativeLibrary).Assembly.Location is string s && !string.IsNullOrEmpty(s) ? Path.GetDirectoryName(s) : null;
var root = Environment.GetEnvironmentVariable("IKVM_LIBRARY_PATH") ?? asml;

// assembly possible loaded in memory: we have no available search path
Expand Down

0 comments on commit db67e8a

Please sign in to comment.