[Mono-list] Detecting if platform is Mac
Miguel de Icaza
miguel at novell.com
Sun Jan 4 22:14:09 EST 2009
> 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 added support for reporting this value back, but it turned out to
break too much code in both Mono and our own modules, so we took this
A lot of code assumed that it was Unix if the value was Unix, and when
we returned the new value assumed it was running on Windows.
We will continue to monitor progress on third party code and eventually
make this change.
But in general, the PlatformID is a poor way of detecting the platform,
and instead you should base your code on other parameters like path
separators for example.
More information about the Mono-list