[Mono-list] Detecting if platform is Mac

Jonathan Pryor jonpryor at vt.edu
Wed Dec 31 22:24:31 EST 2008


On Wed, 2008-12-31 at 15:33 -0500, Geoff Norton wrote:
> On Wed, 2008-12-31 at 11:53 -0800, Erik Ylvisaker wrote:
> > 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
> example.

Or use Mono.Unix.Native.Syscall.uname():

http://go-mono.com/docs/index.aspx?tlink=0@ecma%3a285%23Syscall%2fM%2f231

The Utsname.system field is what you're after.

 - Jon




More information about the Mono-list mailing list