[Mono-list] Detecting if platform is Mac
eylvisaker at physics.ucdavis.edu
Mon Jan 5 13:51:35 EST 2009
So, the reason I want to detect if we are running MacOS is I am writing
Mac OpenGL bindings for the OpenTK project. On MacOS we need to make
appropriate AGL calls instead of GLX or WGL calls in order to construct
an OpenGL context. Perhaps a better solution would be to check the type
of the XPlatUI driver to see what it is, although I'd like to avoid
writing code which depends on private mono internals.
Miguel de Icaza 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 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
> patch out.
> 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