-
Notifications
You must be signed in to change notification settings - Fork 896
/
run.sh
executable file
·62 lines (51 loc) · 1.36 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
#
# Step 1: Detect the operating system
#
MAC="Mac OS X"
WIN="Windows"
LIN="Linux"
if [ `uname` = "Darwin" ]; then
OS=$MAC
elif [ `uname` = "Linux" ]; then
OS=$LIN
else
OS=$WIN
fi
#
# Step 2: Determine game name
#
APP_PATH=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+1] != "") { if (patharr[idx] != "/") {printf("%s/", patharr[idx]); idx++ }} }'`
APP_PATH=`cd "$APP_PATH"; pwd`
cd "$APP_PATH"
GAME_NAME=${APP_PATH##*/}
if [ "$OS" = "$MAC" ]; then
EXE_PATH=$APP_PATH/bin/Debug/${GAME_NAME}.app/Contents/MacOS/${GAME_NAME}
elif [ "$OS" = "$LIN" ]; then
EXE_PATH=$APP_PATH/bin/Debug/${GAME_NAME}.exe
else #Windows
EXE_PATH=$APP_PATH/bin/Debug/${GAME_NAME}.exe
fi
VERSION="Debug Version from /bin/Debug"
if [ ! -f "${EXE_PATH}" ]; then
if [ "$OS" = "$MAC" ]; then
EXE_PATH=$APP_PATH/bin/Release/${GAME_NAME}.app/Contents/MacOS/${GAME_NAME}
elif [ "$OS" = "$LIN" ]; then
EXE_PATH=$APP_PATH/bin/Release/${GAME_NAME}.exe
else #Windows
EXE_PATH=$APP_PATH/bin/Release/${GAME_NAME}.exe
fi
VERSION="Release Version from /bin/Release"
fi
if [ ! -f "${EXE_PATH}" ]; then
echo "Please build the game using ./build.sh" >&2
exit -1
fi
echo "Running ${VERSION}"
if [ "$OS" = "$MAC" ]; then
"${EXE_PATH}"
elif [ "$OS" = "$LIN" ]; then
mono "$EXE_PATH"
else #Windows
"${EXE_PATH}"
fi