[Mono-list] Detecting if platform is Mac

Petit Eric surfzoid at gmail.com
Mon Jan 5 14:57:42 EST 2009


argg, sorry chris , i would like to send this to the list :

declare a "string Platform = "win";"
use :
if(environment.platformid == unix) to use a process with redirect
output and start
process.start("uname -a");
then parse the response with .indexof

i remember, for the process + return function, yu can use my class :
http://monoosc.svn.sourceforge.net/viewvc/monoosc/MonoOSC/MonoOSC/Class/UnixShell.cs?revision=34&view=markup
:-)

2009/1/5 Erik Ylvisaker <eylvisaker at physics.ucdavis.edu>:
> 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.
>>
>>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>



-- 

Cordially.

Small Eric Quotations of the days:
---------------------------------------------------------------------------
If one day one reproaches you that your work is not a work of
professional, say you that:
Amateurs built the arch of Noah, and professionals the Titanic.
---------------------------------------------------------------------------

Few people are done for independence, it is the privilege of the powerful ones.
---------------------------------------------------------------------------

No key was wounded during the drafting of this message.


More information about the Mono-list mailing list