Skip to content
Snippets Groups Projects
Commit 74c39129 authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

Merge pull request #5086 from chrisdunelm/coreclr_platforms

Support coreclr platform detection
parents 76206491 c65ceefb
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment