[Mono-list] Reliable OS identification on Mono
Gert Driesen
gert.driesen at telenet.be
Tue Sep 23 03:06:00 EDT 2008
Hi Marc,
MS added a MacOSX value to the PlatformID enumeration in .NET 3.5 SP1 / .NET 2.0 SP2, but I don't think Mono supports this yet.
Adding support for the MacOSX value may actually break existing applications - and even our our class libraries / unit tests.- on MacOSX. A lot of code actually (wrongly) assumes that - if the platform is not Unix - they're running on Windows.
Gert
From: Marc Glenn
Sent: Tuesday, September 23, 2008 8:01 AM
To: Vladislav Rastrusny
Cc: mono-list at lists.ximian.com
Subject: Re: [Mono-list] Reliable OS identification on Mono
Hi.
You can use a condition statement like this.
if(System.Environment.OSVersion.Platform == PlatformID.Unix)
Here is the link to the Mono API:
http://www.go-mono.com/docs/index.aspx?link=T%3aSystem.OperatingSystem%2f*
However, I can't find a way to check if its in MAC.
Hope this helps,
Marc Glenn
Vladislav Rastrusny wrote:
Hello.
Is there a way to reliably determine OS, application is running on in Mono?
My application needs to access files of some external application
(also multiplatform) and those files are located in different places
depending on OS.
On Windows it is under ApplicationData, on Linux under /home/user/app
and on MacOS... I don't know ;) Never installed it.
Thanks in advance.
_______________________________________________
Mono-list maillist - Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list
--------------------------------------------------------------------------------
_______________________________________________
Mono-list maillist - Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20080923/42dbf5ff/attachment.html
More information about the Mono-list
mailing list