[Mono-osx] OSX vs Linux

Gavin Landon Gavin.Landon at ignitetech.com
Fri Dec 14 12:14:28 EST 2007


Well, the only thing I can come up with is looking at the version
itself.  Of course this method will have be changed and the Major bumped
up as Linux catches up..
------------------
static public string GetOS()
{
	int p = (int) Environment.OSVersion.Platform;
	int v = (int) Environment.OSVersion.Version.Major;
	
	if(Environment.OSVersion.Platform.ToString()=="Win32NT")
		return "Windows";
	
        if ((p == 4) || (p == 128)) {
		if(v<8)
			return "Unix";
		else
			return "OSX";
	} 
	
	return "Unknown";
}


-----Original Message-----
From: mono-osx-bounces at lists.ximian.com
[mailto:mono-osx-bounces at lists.ximian.com] On Behalf Of Gavin Landon
Sent: Friday, December 14, 2007 10:30 AM
To: mono-osx at lists.ximian.com
Subject: [Mono-osx] OSX vs Linux

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";
	}
}
_______________________________________________
Mono-osx mailing list
Mono-osx at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-osx


More information about the Mono-osx mailing list