[Mono-dev] Why does Environment.OSVersion.Platform report PlatformID.Unix on OS X?

Rodrigo Kumpera kumpera at gmail.com
Sun Nov 13 22:36:27 EST 2011


Originally .NET had no enum value for OSX and we returned Unix.
The, 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.

On Sun, Nov 13, 2011 at 11:48 PM, Uli Hertlein <uli at xdt.com.au> wrote:

> Hi guys,
>
> the subject pretty much sums it up.
>
> Environment.OSVersion.Platform on OS X reports PlatformID.Unix rather
> than PlatformID.MacOSX.
>
> The responsible code in mcs/class/corlib/System/Environment.cs
> explicitly remaps PlatformID.MacOSX to Unix:
>
> public static OperatingSystem OSVersion {
>   get {
>     if (os == null) {
>       Version v = Version.CreateFromString (GetOSVersionString ());
>       PlatformID p = Platform;
>       // UH: Why is this remapped?
>       if (p == PlatformID.MacOSX)
>         p = PlatformID.Unix;
>       os = new OperatingSystem (p, v);
>     }
>     return os;
>   }
> }
>
> While I totally agree that OS X *is-a* Unix-like operating system,
> shouldn't this report the highest-level of detail that is available,
> rather than throwing away useful information?
>
> Cheers,
> /uli
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20111114/607aa555/attachment.html 


More information about the Mono-devel-list mailing list