static RuntimeInformation() { switch (Environment.OSVersion.Platform) { case PlatformID.Unix: if (Directory.Exists("/Applications") & Directory.Exists("/System") & Directory.Exists("/Users") & Directory.Exists("/Volumes")) { _osPlatform = OSPlatform.OSX; } else { _osPlatform = OSPlatform.Linux; } break; case PlatformID.MacOSX: _osPlatform = OSPlatform.OSX; break; default: _osPlatform = OSPlatform.Windows; break; } }
public static bool IsOSPlatform(OSPlatform osPlatform) => _osPlatform == osPlatform;