OpenRA.Platform.GetCurrentPlatform C# (CSharp) Method

GetCurrentPlatform() static private method

static private GetCurrentPlatform ( ) : PlatformType
return PlatformType
        static PlatformType GetCurrentPlatform()
        {
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                return PlatformType.Windows;

            try
            {
                var psi = new ProcessStartInfo("uname", "-s");
                psi.UseShellExecute = false;
                psi.RedirectStandardOutput = true;
                var p = Process.Start(psi);
                var kernelName = p.StandardOutput.ReadToEnd();
                if (kernelName.Contains("Darwin"))
                    return PlatformType.OSX;

                return PlatformType.Linux;
            }
            catch { }

            return PlatformType.Unknown;
        }