I don't have a lot of details on the underlying implementation of Mono (just
because I haven't downloaded all the source).
However, I have a feeling that for "interoperability reasons", they fool
your code into believing you are running under windows. I can see where that
might come in handy, deceitful as it may be :-)
Perhaps you can try to use the DllImport tag to write a p/invoke function
call to a Windows dll (like perhaps one of the registry API functions). Wrap
this up in a Try-Catch, and if the function fails (because the DLL doesn't
exist), then you are not in Windows. The only catch may be if the system is
using Wine or some windows emulator on Linux.
-Rob Teixeira [MVP]
"Christoffer Soerensen" <sa********@hotmail.com> wrote in message
news:ac**************************@posting.google.c om...
Hi,
I am currently building an application in C# using mono and .NET. I
want to get a MIME type for a specific file, which is why I want to
detect the OS on which the application is running. On Windows, I would
look up the registry, on Linux/OSX/etc. I would look in
/etc/mime-types (or where the mime types are located). How would I
detect the OS ?
I have tried the following:
OperatingSystem os = Environment.OSVersion;
Version vs = os.Version;
This gives me: "5.1.2600" on Linux :-)
Maybe it is better to build a MIME database on my own instead of
relying on the OS ?
Regards,
Christoffer