File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Runtime . InteropServices ;
3+
4+ public static class NativeLibraryNames
5+ {
6+ public static string GvcLib => _gvcLib . Value ;
7+ public static string CGraphLib => _cgraphLib . Value ;
8+ public static string XDotLib => _xdotLib . Value ;
9+ public static string GraphvizWrapperLib => _wrapperLib . Value ;
10+
11+ private static readonly Lazy < string > _gvcLib = new ( ( ) => Resolve ( "gvc.dll" , "libgvc.so.6" ) ) ;
12+ private static readonly Lazy < string > _cgraphLib = new ( ( ) => Resolve ( "cgraph.dll" , "libcgraph.so.6" ) ) ;
13+ private static readonly Lazy < string > _xdotLib = new ( ( ) => Resolve ( "xdot.dll" , "libxdot.so.4" ) ) ;
14+ private static readonly Lazy < string > _wrapperLib = new ( ( ) => Resolve ( "GraphvizWrapper.dll" , "libGraphvizWrapper.so" ) ) ;
15+
16+ private static string Resolve ( string windows , string linux , string ? mac = null )
17+ {
18+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) return windows ;
19+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ) return linux ;
20+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ) return mac ?? throw new PlatformNotSupportedException ( "macOS not supported yet." ) ;
21+ throw new PlatformNotSupportedException ( "Unknown platform" ) ;
22+ }
23+ }
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ test-all: build-tests
5050 just test Rubjerg.Graphviz.TransitiveTest/ Rubjerg.Graphviz.TransitiveTest.csproj
5151
5252# Run the nuget.org tests
53- test-nugetorg : build-tests
53+ test-nugetorg :
5454 dotnet tool restore
5555 dotnet restore NugetOrgTests/ Rubjerg.Graphviz.NugetOrgTests.sln
5656 just build NugetOrgTests/ Rubjerg.Graphviz.NugetOrgTests.sln
You can’t perform that action at this time.
0 commit comments