File tree 1 file changed +14
-16
lines changed
1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -27,24 +27,22 @@ internal static class NativeMethods
27
27
28
28
static NativeMethods ( )
29
29
{
30
- if ( Platform . IsRunningOnNetFramework ( ) || Platform . IsRunningOnNetCore ( ) )
30
+ var nativeLibraryDir = GlobalSettings . GetAndLockNativeLibraryPath ( ) ;
31
+
32
+ if ( nativeLibraryDir != null )
31
33
{
32
- string nativeLibraryDir = GlobalSettings . GetAndLockNativeLibraryPath ( ) ;
33
- if ( nativeLibraryDir != null )
34
+ var nativeLibraryPath = Path . Combine ( nativeLibraryDir , libgit2 + Platform . GetNativeLibraryExtension ( ) ) ;
35
+
36
+ // Try to load the library from the path explicitly.
37
+ // If this call succeeds, further DllImports will find the library loaded and not attempt to load it again.
38
+ // If it fails, the next DllImport will load the library from safe directories.
39
+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
40
+ {
41
+ LoadWindowsLibrary ( nativeLibraryPath ) ;
42
+ }
43
+ else
34
44
{
35
- string nativeLibraryPath = Path . Combine ( nativeLibraryDir , libgit2 + Platform . GetNativeLibraryExtension ( ) ) ;
36
-
37
- // Try to load the .dll from the path explicitly.
38
- // If this call succeeds further DllImports will find the library loaded and not attempt to load it again.
39
- // If it fails the next DllImport will load the library from safe directories.
40
- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
41
- {
42
- LoadWindowsLibrary ( nativeLibraryPath ) ;
43
- }
44
- else
45
- {
46
- LoadUnixLibrary ( nativeLibraryPath , RTLD_NOW ) ;
47
- }
45
+ LoadUnixLibrary ( nativeLibraryPath , RTLD_NOW ) ;
48
46
}
49
47
}
50
48
You can’t perform that action at this time.
0 commit comments