File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "supports" : {
3- "net46.app" : {}
43 },
54 "dependencies" : {
65 "Microsoft.NETCore" : " 5.0.0" ,
76 "Microsoft.NETCore.Portable.Compatibility" : " 1.0.0" ,
7+ "System.Runtime.InteropServices.RuntimeInformation" : " 4.0.0-beta-23409" ,
88 "System.Security.Cryptography.X509Certificates" : " 4.0.0-beta-23409" ,
99 "System.Security.SecureString" : " 4.0.0-beta-23409" ,
1010 "LibGit2Sharp.NativeBinaries" : " [1.0.132]" ,
Original file line number Diff line number Diff line change 11using System ;
2+ using System . Runtime . InteropServices ;
23
34namespace LibGit2Sharp . Core
45{
@@ -20,6 +21,7 @@ public static OperatingSystemType OperatingSystem
2021 {
2122 get
2223 {
24+ #if NET40
2325 // See http://www.mono-project.com/docs/faq/technical/#how-to-detect-the-execution-platform
2426 switch ( ( int ) Environment . OSVersion . Platform )
2527 {
@@ -33,6 +35,24 @@ public static OperatingSystemType OperatingSystem
3335 default :
3436 return OperatingSystemType . Windows ;
3537 }
38+ #else
39+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
40+ {
41+ return OperatingSystemType . Windows ;
42+ }
43+ else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
44+ {
45+ return OperatingSystemType . Unix ;
46+ }
47+ else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
48+ {
49+ return OperatingSystemType . MacOSX ;
50+ }
51+ else
52+ {
53+ throw new InvalidOperationException ( ) ;
54+ }
55+ #endif
3656 }
3757 }
3858 }
You can’t perform that action at this time.
0 commit comments