@@ -24,69 +24,6 @@ protected override Assembly Load(AssemblyName assemblyName)
2424 ? this . LoadFromAssemblyPath ( path )
2525 : Default . LoadFromAssemblyName ( assemblyName ) ;
2626 }
27-
28- protected override IntPtr LoadUnmanagedDll ( string unmanagedDllName )
29- {
30- var modulePtr = IntPtr . Zero ;
31-
32- if ( unmanagedDllName . StartsWith ( "git2-" , StringComparison . Ordinal ) ||
33- unmanagedDllName . StartsWith ( "libgit2-" , StringComparison . Ordinal ) )
34- {
35- var directory = GetNativeLibraryDirectory ( ) ;
36- var extension = GetNativeLibraryExtension ( ) ;
37-
38- if ( ! unmanagedDllName . EndsWith ( extension , StringComparison . Ordinal ) )
39- {
40- unmanagedDllName += extension ;
41- }
42-
43- var nativeLibraryPath = Path . Combine ( directory , unmanagedDllName ) ;
44- if ( ! File . Exists ( nativeLibraryPath ) )
45- {
46- nativeLibraryPath = Path . Combine ( directory , "lib" + unmanagedDllName ) ;
47- }
48-
49- modulePtr = this . LoadUnmanagedDllFromPath ( nativeLibraryPath ) ;
50- }
51-
52- return ( modulePtr != IntPtr . Zero ) ? modulePtr : base . LoadUnmanagedDll ( unmanagedDllName ) ;
53- }
54-
55- internal static string GetNativeLibraryDirectory ( )
56- {
57- var dir = Path . GetDirectoryName ( typeof ( GitLoaderContext ) . Assembly . Location ) ;
58-
59- // When invoked as a MSBuild task, the native libraries will be at
60- // ../runtimes. When invoked from the nbgv CLI, the libraries
61- // will be at ./runtimes.
62- string runtimePath = RuntimePath ;
63- if ( ! Directory . Exists ( Path . Combine ( dir , runtimePath ) ) )
64- {
65- runtimePath = "." + runtimePath ;
66- }
67-
68- return Path . Combine ( dir , runtimePath , RuntimeIdMap . GetNativeLibraryDirectoryName ( RuntimeEnvironment . GetRuntimeIdentifier ( ) ) , "native" ) ;
69- }
70-
71- private static string GetNativeLibraryExtension ( )
72- {
73- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
74- {
75- return ".dll" ;
76- }
77-
78- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
79- {
80- return ".dylib" ;
81- }
82-
83- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
84- {
85- return ".so" ;
86- }
87-
88- throw new PlatformNotSupportedException ( ) ;
89- }
9027 }
9128}
9229#endif
0 commit comments