File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed
Expand file tree Collapse file tree 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
2727
2828 static NativeMethods ( )
2929 {
30- if ( Platform . IsRunningOnNetFramework ( ) || Platform . IsRunningOnNetCore ( ) )
30+ var nativeLibraryDir = GlobalSettings . GetAndLockNativeLibraryPath ( ) ;
31+
32+ if ( nativeLibraryDir != null )
3133 {
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
3444 {
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 ) ;
4846 }
4947 }
5048
You can’t perform that action at this time.
0 commit comments