+ StringOutputStream path( 256 );
+ StringOutputStream modpath( 256 );
+ const char* gamename = GlobalRadiant().getGameName();
+ const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
+ const char* enginePath = GlobalRadiant().getEnginePath();
+ path << enginePath << basegame << '/' << filename;
+ modpath << enginePath << gamename << '/' << filename;
+ if ( file_exists( modpath.c_str() ) ){
+ globalOutputStream() << "opening file '" << modpath.c_str() << "' (line " << cursorpos << " info ignored)\n";
+ ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", modpath.c_str(), 0, 0, SW_SHOW );
+ }
+ else if ( file_exists( path.c_str() ) ){
+ globalOutputStream() << "opening file '" << path.c_str() << "' (line " << cursorpos << " info ignored)\n";
+ ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", path.c_str(), 0, 0, SW_SHOW );
+ }
+ else{
+ globalOutputStream() << "Failed to open '" << filename << "\n";
+ }
+ return;
+ }
+ else{
+ StringOutputStream path( 256 );
+ StringOutputStream modpath( 256 );
+ const char* gamename = GlobalRadiant().getGameName();
+ const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
+ const char* enginePath = GlobalRadiant().getEnginePath();
+ path << enginePath << basegame << '/' << filename;
+ modpath << enginePath << gamename << '/' << filename;
+ if ( file_exists( modpath.c_str() ) ){
+ globalOutputStream() << "opening file '" << modpath.c_str() << "' (line " << cursorpos << " info ignored)\n";
+ DoGtkTextEditor( modpath.c_str(), cursorpos, length );
+ }
+ else if ( file_exists( path.c_str() ) ){
+ globalOutputStream() << "opening file '" << path.c_str() << "' (line " << cursorpos << " info ignored)\n";
+ DoGtkTextEditor( path.c_str(), cursorpos, length );
+ }
+ else{
+ globalOutputStream() << "Failed to open '" << filename << "\n";
+ }