- // set without saving, the class is not in a coherent state yet
- // just do the value change and call to start logging, CGamesDialog will pickup when relevant
- g_PrefsDlg.mGamesDialog.m_bLogConsole = true;
- g_PrefsDlg.mGamesDialog.m_bForceLogConsole = true;
- Sys_LogFile();
- }
-
- // create a primary .pid for global init run
- pid = fopen (g_pidFile.GetBuffer(), "w");
- if (pid)
- fclose (pid);
-
- // a safe check to avoid people running broken installations
- // (otherwise, they run it, crash it, and blame us for not forcing them hard enough to pay attention while installing)
- // make something idiot proof and someone will make better idiots, this may be overkill
- // let's leave it disabled in debug mode in any case
- // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=431
-#ifndef _DEBUG
-#define CHECK_VERSION
-#endif
-#ifdef CHECK_VERSION
- // locate and open RADIANT_MAJOR and RADIANT_MINOR
- qboolean bVerIsGood = true;
- Str ver_file_name;
- ver_file_name = g_strAppPath;
- ver_file_name += "RADIANT_MAJOR";
- FILE *ver_file = fopen (ver_file_name.GetBuffer(), "r");
- if (ver_file)
- {
- char buf[10];
- int chomp;
- fread(buf, 1, 10, ver_file);
- // chomp it (the hard way)
- chomp = 0;
- while(buf[chomp] >= '0' && buf[chomp] <= '9')
- chomp++;
- buf[chomp] = '\0';
- if (strcmp(buf, RADIANT_MAJOR_VERSION))
- {
- Sys_Printf("ERROR: file RADIANT_MAJOR doesn't match ('%s')\n", buf);
- bVerIsGood = false;
- }
- }
- else
- {
- Sys_Printf("ERROR: can't find RADIANT_MAJOR in '%s'\n", ver_file_name.GetBuffer());
- bVerIsGood = false;
- }
- ver_file_name = g_strAppPath;
- ver_file_name += "RADIANT_MINOR";
- ver_file = fopen (ver_file_name.GetBuffer(), "r");
- if (ver_file)
- {
- char buf[10];
- int chomp;
- fread(buf, 1, 10, ver_file);
- // chomp it (the hard way)
- chomp = 0;
- while(buf[chomp] >= '0' && buf[chomp] <= '9')
- chomp++;
- buf[chomp] = '\0';
- if (strcmp(buf, RADIANT_MINOR_VERSION))
- {
- Sys_Printf("ERROR: file RADIANT_MINOR doesn't match ('%s')\n", buf);
- bVerIsGood = false;
- }
- }
- else
- {
- Sys_Printf("ERROR: can't find RADIANT_MINOR in '%s'\n", ver_file_name.GetBuffer());
- bVerIsGood = false;
- }
- if (!bVerIsGood)
- {
- CString msg;
- msg = "This editor binary (" RADIANT_VERSION ") doesn't match what the latest setup has configured in this directory\n";
- msg += "Make sure you run the right/latest editor binary you installed\n";
- msg += g_strAppPath; msg += "\n";
- msg += "Check http://www.qeradiant.com/faq/index.cgi?file=219 for more information";
- gtk_MessageBox(NULL, msg.GetBuffer(), "Radiant", MB_OK, "http://www.qeradiant.com/faq/index.cgi?file=219");
- _exit(-1);
- }
-#endif
-
- g_qeglobals.disable_ini = false;
- g_PrefsDlg.Init ();
-
- // close the primary
- if (remove (g_pidFile.GetBuffer ()) == -1)
- {
- CString msg;
- msg = "WARNING: Could not delete "; msg += g_pidGameFile;
- gtk_MessageBox (NULL, msg, "Radiant", MB_OK | MB_ICONERROR );
- }
-
- /*!
- now the secondary game dependant .pid file
- http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=297
- */
- g_pidGameFile = g_PrefsDlg.m_rc_path->str;
- g_pidGameFile += "radiant-game.pid";
-
- pid = fopen (g_pidGameFile.GetBuffer(), "r");
- if (pid != NULL)
- {
- fclose (pid);
- CString msg;
- if (remove (g_pidGameFile.GetBuffer ()) == -1)
- {
- msg = "WARNING: Could not delete "; msg += g_pidGameFile;
- gtk_MessageBox (NULL, msg, "Radiant", MB_OK | MB_ICONERROR );
- }