NUnit.Framework.Internal.OSPlatform.CheckIfIsMacOSX C# (CSharp) Method

CheckIfIsMacOSX() static private method

static private CheckIfIsMacOSX ( PlatformID platform ) : bool
platform PlatformID
return bool
        static bool CheckIfIsMacOSX(PlatformID platform)
        {
            if (platform == PlatformID.MacOSX)
            return true;

            if (platform != PlatformID.Unix)
                return false;

            IntPtr buf = Marshal.AllocHGlobal(8192);
            bool isMacOSX = false;
            if (uname(buf) == 0)
            {
                string os = Marshal.PtrToStringAnsi(buf);
                isMacOSX = os.Equals("Darwin");
            }
            Marshal.FreeHGlobal(buf);
            return isMacOSX;
        }