add command line options:
[xonotic/netradiant.git] / setup / data / osx / NetRadiant.app / Contents / MacOS / netradiant.sh
1 #!/bin/sh
2
3 MY_DIRECTORY="${0%/*}" # cut off the script name
4 MY_DIRECTORY="${MY_DIRECTORY%/*}" # cut off MacOS
5 MY_DIRECTORY="${MY_DIRECTORY%/*}" # cut off Contents
6
7 #export DYLD_LIBRARY_PATH="$MY_DIRECTORY/Contents/MacOS"
8
9 cd "$MY_DIRECTORY/Contents/MacOS/install"
10
11 # autodetect nexuiz installs
12 NEX_DIRECTORY="/${MY_DIRECTORY%/*}"
13 while :; do
14         if [ -z "$NEX_DIRECTORY" ]; then
15                 break
16         fi
17         if [ -f "$NEX_DIRECTORY/data/common-spog.pk3" ]; then
18                 if [ -d "$NEX_DIRECTORY/Nexuiz.app" ]; then
19                         break
20                 fi
21         fi
22         NEX_DIRECTORY=${NEX_DIRECTORY%/*}
23 done
24 case "$NEX_DIRECTORY" in
25         //*)
26                 NEX_DIRECTORY=${NEX_DIRECTORY#/}
27                 set -- -global-gamefile nexuiz.game -nexuiz.game-EnginePath "$NEX_DIRECTORY/"
28                 # -global-gamePrompt false?
29                 ;;
30         *)
31                 set --
32                 ;;
33 esac
34
35 if [ -x /usr/bin/open-x11 ]; then
36         exec /usr/bin/open-x11 ./radiant.ppc "$@"
37 else
38         exec ./radiant.ppc "$@"
39 fi