libglui / glui

GLUI is a GLUT-based C++ user interface library which provides controls such as buttons, checkboxes, radio buttons, and spinners to OpenGL applications. It is window-system independent, using GLUT or FreeGLUT.
Other
196 stars 81 forks source link

Filebrowser descends/ascends two levels #20

Open josch opened 9 years ago

josch commented 9 years ago

https://sourceforge.net/p/glui/bugs/26/

The function void GLUI_FileBrowser::dir_list_callback(GLUI_Control *glui_object) in glui_filebrowser.cpp does 2 directory changes when gnuc compiler used in windows. Easily seen if you double click on the .. in the browser and it takes you up not to the parent directory but rather the "grand"parent directory.

The problem lines are

#ifdef GNUC
    chdir(selected+1);
#endif
#ifdef _WIN32
    SetCurrentDirectory(selected+1);
#endif

because both GNUC and WIN32 are true when using my gnuc compiler in windows ie dev-cpp.

The logical fix seems to be to change to an #elif as follows

#ifdef GNUC
    chdir(selected+1);
#elif _WIN32
    SetCurrentDirectory(selected+1);
#endif