[Mono-dev] Why does Environment.OSVersion.Platform report PlatformID.Unix on OS X?
Stefanos A.
stapostol at gmail.com
Mon Nov 14 01:46:11 EST 2011
2011/11/14 Uli Hertlein <uli at xdt.com.au>
> On 14/11/2011 14:36, Rodrigo Kumpera wrote:
> > Originally .NET had no enum value for OSX and we returned Unix.
> > Then, when it was introduced by microsoft, we tried to switch to the
> > new value but too much stuff broke. We never tried again ever since a
> > couple of years ago.
>
> Thanks for the explanation Rodrigo!
> Do you remember, did it break things in Mono, or applications?
>
> At this time this makes it necessary to implement work-arounds in code
> that is shared between .NET/Mono and Silverlight.
>
> I'm curious, what is everyone's favourite kludge to detect OS X on Mono?
> The reason I'm asking is that my code wants to check /Volumes on OS X
> and other locations on Windows and Linux.
>
I prefer to p/invoke uname() from libc. It returns "Darwin" on Mac OS X and
"Linux" on Linux - nice and simple!
Example code here<http://opentk.svn.sourceforge.net/viewvc/opentk/trunk/Source/OpenTK/Configuration.cs?revision=3089&view=markup>
(search
for DetectUnixKernel()).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20111114/c786a914/attachment.html
More information about the Mono-devel-list
mailing list