diff options
author | 2016-02-05 09:04:46 +0000 | |
---|---|---|
committer | 2016-02-05 09:04:46 +0000 | |
commit | c65ceefbe0681559a0bc3e745ad619d5c577fc0e (patch) | |
tree | e4e902aa29bb8e2bc6171fe1ee465f8c1b7d841c /src/csharp/Grpc.Core | |
parent | f6c7951e448745c61302216eb78147bdcd399488 (diff) |
Support coreclr platform detection
Coreclr uses different platform detection primitives to full .NET
Diffstat (limited to 'src/csharp/Grpc.Core')
-rw-r--r-- | src/csharp/Grpc.Core/Internal/PlatformApis.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core/Internal/PlatformApis.cs b/src/csharp/Grpc.Core/Internal/PlatformApis.cs index f0c5b0f63f..fb1acfb607 100644 --- a/src/csharp/Grpc.Core/Internal/PlatformApis.cs +++ b/src/csharp/Grpc.Core/Internal/PlatformApis.cs @@ -53,12 +53,18 @@ namespace Grpc.Core.Internal static PlatformApis() { +#if DNXCORE50 + isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + isMacOSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); +#else var platform = Environment.OSVersion.Platform; // PlatformID.MacOSX is never returned, commonly used trick is to identify Mac is by using uname. isMacOSX = (platform == PlatformID.Unix && GetUname() == "Darwin"); isLinux = (platform == PlatformID.Unix && !isMacOSX); isWindows = (platform == PlatformID.Win32NT || platform == PlatformID.Win32S || platform == PlatformID.Win32Windows); +#endif isMono = Type.GetType("Mono.Runtime") != null; } |