add command line options:
[xonotic/netradiant.git] / setup / data / osx / NetRadiant.app / Contents / MacOS / netradiant.sh
index 4cb8749f5a5471e8a4ecff35bc6a3122d979f915..cb07b08d15cdb499496d9bf0d84b376101ae6229 100755 (executable)
@@ -6,5 +6,34 @@ MY_DIRECTORY="${MY_DIRECTORY%/*}" # cut off Contents
 
 #export DYLD_LIBRARY_PATH="$MY_DIRECTORY/Contents/MacOS"
 
-cd "$MY_DIRECTORY/Contents/MacOS/NetRadiant/install"
-exec /usr/bin/open-x11 ./radiant.ppc
+cd "$MY_DIRECTORY/Contents/MacOS/install"
+
+# autodetect nexuiz installs
+NEX_DIRECTORY="/${MY_DIRECTORY%/*}"
+while :; do
+       if [ -z "$NEX_DIRECTORY" ]; then
+               break
+       fi
+       if [ -f "$NEX_DIRECTORY/data/common-spog.pk3" ]; then
+               if [ -d "$NEX_DIRECTORY/Nexuiz.app" ]; then
+                       break
+               fi
+       fi
+       NEX_DIRECTORY=${NEX_DIRECTORY%/*}
+done
+case "$NEX_DIRECTORY" in
+       //*)
+               NEX_DIRECTORY=${NEX_DIRECTORY#/}
+               set -- -global-gamefile nexuiz.game -nexuiz.game-EnginePath "$NEX_DIRECTORY/"
+               # -global-gamePrompt false?
+               ;;
+       *)
+               set --
+               ;;
+esac
+
+if [ -x /usr/bin/open-x11 ]; then
+       exec /usr/bin/open-x11 ./radiant.ppc "$@"
+else
+       exec ./radiant.ppc "$@"
+fi