[Mono-osx] OSX vs Linux

Gavin Landon Gavin.Landon at ignitetech.com
Fri Dec 14 11:29:54 EST 2007


I'm having some trouble distinguishing the difference between Linux and
OSX.  

I have a test method I'm using to try different things out and both OSX
and Linux come back with "Unix" as the text and p="4".  The only
difference is OSVersion will return a much lower version number on Linux
that on Mac.  Is there another way to tell?

------------------
static public string GetOS()
{
	int p = (int) Environment.OSVersion.Platform;
	
	MessageBox.Show("Environment.OSVersion.Version: " +
Environment.OSVersion.Version.ToString());
	MessageBox.Show("Environment.OSVersion: " +
Environment.OSVersion.ToString());
	MessageBox.Show("OS Version: " +
Environment.OSVersion.Platform.ToString() + " #" + p.ToString());

	if(Environment.OSVersion.Platform.ToString()=="Win32NT")
		return "Windows";
        if ((p == 4) || (p == 128)) {
		return "Unix";
	} else {
        	return "Not Unix";
	}
}


More information about the Mono-osx mailing list