Made unix kernel detection less strict. The program is now allowed to run even the specific kernel name is unknown. Partly fixes issue [#1382]: "OpenTK and other Unix OS".

This commit is contained in:
the_fiddler 2009-11-16 14:28:37 +00:00
parent 9cb660bf85
commit b96aaabcae

View file

@ -53,13 +53,14 @@ namespace OpenTK
else if (System.Environment.OSVersion.Platform == PlatformID.Unix || else if (System.Environment.OSVersion.Platform == PlatformID.Unix ||
System.Environment.OSVersion.Platform == (PlatformID)4) System.Environment.OSVersion.Platform == (PlatformID)4)
{ {
// Distinguish between Linux, Mac OS X and other Unix operating systems.
// Distinguish between Unix and Mac OS X kernels. string kernel_name = DetectUnixKernel();
switch (DetectUnixKernel()) switch (kernel_name)
{ {
case "Unix": case null:
runningOnUnix = true; case "":
break; throw new PlatformNotSupportedException(
"Unknown platform. Please file a bug report at http://www.opentk.com/node/add/project-issue/opentk");
case "Linux": case "Linux":
runningOnLinux = runningOnUnix = true; runningOnLinux = runningOnUnix = true;
@ -70,8 +71,8 @@ namespace OpenTK
break; break;
default: default:
throw new PlatformNotSupportedException( runningOnUnix = true;
DetectUnixKernel() + ": Unknown Unix platform. Please report this error at http://www.opentk.com."); break;
} }
} }
else else
@ -178,7 +179,7 @@ namespace OpenTK
} }
/// <summary> /// <summary>
/// Detects the unix kernel by p/invoking the uname call in libc. /// Detects the unix kernel by p/invoking uname (libc).
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private static string DetectUnixKernel() private static string DetectUnixKernel()