[Mono-list] Detecting if platform is Mac

Geoff Norton gnorton at novell.com
Wed Dec 31 15:33:51 EST 2008

On Wed, 2008-12-31 at 11:53 -0800, Erik Ylvisaker wrote:
> Apparently in .NET 3.5 Microsoft added two members to the 
> System.PlatformID type, called Xbox and MacOSX.  Is there any support in 
> Mono for these?  Of course, I don't care about the Xbox value I am just 
> interested in being able to detect whether my code is running on MacOS 
> or Linux.

We might support this in 2.4.

> Otherwise, is there another recommended way to detect if running on 
> MacOS?  Currently we are spawning uname and checking to see if the 
> output is "Darwin".  This works, but I don't know if there's a better way.

Dont spawn uname, p/invoke it.  Look in
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs for an


> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

More information about the Mono-list mailing list