- // if we're inside a Nexuiz install
- // default to nexuiz.game (unless the user used an option to inhibit this)
- bool nogamedetect = false;
- int i;
- for(i = 1; i < g_argc - 1; ++i)
- if(g_argv[i][0] == '-')
- {
- if(!strcmp(g_argv[i], "-gamedetect"))
- nogamedetect = !strcmp(g_argv[i+1], "false");
- ++i;
- }
- if(!nogamedetect)
- {
- static char buf[1024 + 64];
- strncpy(buf, environment_get_app_path(), sizeof(buf));
- buf[sizeof(buf) - 1 - 64] = 0;
- if(!strlen(buf))
- return;
-
- char *p = buf + strlen(buf) - 1; // point directly on the slash of get_app_path
- while(p != buf)
- {
- // TODO add more games to this
-
- // try to detect Nexuiz installs
-#if defined(WIN32)
- if(gamedetect_check_game("nexuiz.game", "data/common-spog.pk3", "nexuiz.exe", buf, p - buf))
-#elif defined(__APPLE__)
- if(gamedetect_check_game("nexuiz.game", "data/common-spog.pk3", "Nexuiz.app/Contents/Info.plist", buf, p - buf))
+ // if we're inside a Nexuiz install
+ // default to nexuiz.game (unless the user used an option to inhibit this)
+ bool nogamedetect = false;
+ int i;
+ for (i = 1; i < g_argc - 1; ++i) {
+ if (g_argv[i][0] == '-') {
+ if (!strcmp(g_argv[i], "-gamedetect")) {
+ nogamedetect = !strcmp(g_argv[i + 1], "false");
+ }
+ ++i;
+ }
+ }
+ if (!nogamedetect) {
+ static char buf[1024 + 64];
+ strncpy(buf, environment_get_app_path(), sizeof(buf));
+ buf[sizeof(buf) - 1 - 64] = 0;
+ if (!strlen(buf)) {
+ return;
+ }
+
+ char *p = buf + strlen(buf) - 1; // point directly on the slash of get_app_path
+ while (p != buf) {
+ // TODO add more games to this
+
+ // try to detect Nexuiz installs
+#if GDEF_OS_WINDOWS
+ if ( gamedetect_check_game( "nexuiz.game", "data/common-spog.pk3", "nexuiz.exe", buf, p - buf ) )
+#elif GDEF_OS_MACOS
+ if ( gamedetect_check_game( "nexuiz.game", "data/common-spog.pk3", "Nexuiz.app/Contents/Info.plist", buf, p - buf ) )