Revan1985's picture

Found possible bug in Configuration Class

Hi all...
i'm new here.
I'm posting this topic to give a intresting information at all.
Today i've downloaded last svn version of OpenTK, and i wanted to try a little tutorial on Opengl3.1
I've started it, but i get an exception that say me "Unknown Platform. Please report to bla bla bla"...
Now, i've wathced the code, and i found this possible bug...
In the Init Method, you use this code :

if (!initialized)
        {
          initialized = true;
 
          if (System.Environment.OSVersion.Platform == PlatformID.Win32NT ||
              System.Environment.OSVersion.Platform == PlatformID.Win32S ||
              System.Environment.OSVersion.Platform == PlatformID.Win32Windows ||
              System.Environment.OSVersion.Platform == PlatformID.WinCE)
              runningOnWindows = true;
 
            // Write config file before using any p/invokes, otherwise Mono won't pick it up.
            if (!RunningOnWindows)
            {
              WriteConfigFile();
            }
 
          else if (System.Environment.OSVersion.Platform == PlatformID.Unix ||
                   System.Environment.OSVersion.Platform == (PlatformID)4)

ok, i thisk that a brace is missed, or not?
it should be

if (!initialized)
        {
          initialized = true;
 
          if (System.Environment.OSVersion.Platform == PlatformID.Win32NT ||
              System.Environment.OSVersion.Platform == PlatformID.Win32S ||
              System.Environment.OSVersion.Platform == PlatformID.Win32Windows ||
              System.Environment.OSVersion.Platform == PlatformID.WinCE)
              runningOnWindows = true;
         {
            // Write config file before using any p/invokes, otherwise Mono won't pick it up.
            if (!RunningOnWindows)
            {
              WriteConfigFile();
            }
          }
          else if (System.Environment.OSVersion.Platform == PlatformID.Unix ||
                   System.Environment.OSVersion.Platform == (PlatformID)4)

i hope this will help...
Hi all, and continue with this nice work (when the opengl4 will be ready?)

:)


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Thanks. No, no missing brace there, it's the indentation that's incorrect. (In fact this code will be removed, it was a failed experiment).

What platform are you running on?

OpenGL 4.1 is 100% ready in svn trunk, it now awaits testing. I'm planning to make a beta release this week.

Revan1985's picture

oh, ok.
I've tryed it in windows vista ultimate and seven ultimate, all x64.
The code is

if (System.Environment.OSVersion.Platform == PlatformID.Win32NT ||
              System.Environment.OSVersion.Platform == PlatformID.Win32S ||
              System.Environment.OSVersion.Platform == PlatformID.Win32Windows ||
              System.Environment.OSVersion.Platform == PlatformID.WinCE)
              runningOnWindows = true;
 
if (!RunningOnWindows)
{
    WriteConfigFile();
}
 else if (System.Environment.OSVersion.Platform == PlatformID.Unix ||
                   System.Environment.OSVersion.Platform == (PlatformID)4)

so is seen like "i'm running on windows? ok, runningOnWindows = true. If not running on windows, write config, else, check platform."
for this reason my compiler (vs2010), is always checking for the next two platform.

the Fiddler's picture

Ah, you are right.

I've reverted the relevant changes, so trunk should work on Windows again.