summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI')
-rw-r--r--src/StardewModdingAPI/unix-launcher.sh40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/StardewModdingAPI/unix-launcher.sh b/src/StardewModdingAPI/unix-launcher.sh
index 6def449d..93e33c78 100644
--- a/src/StardewModdingAPI/unix-launcher.sh
+++ b/src/StardewModdingAPI/unix-launcher.sh
@@ -30,30 +30,38 @@ if [ "$UNAME" == "Darwin" ]; then
cp StardewValley.bin.osx StardewModdingAPI.bin.osx
open -a Terminal ./StardewModdingAPI.bin.osx $@
else
- # get launcher
- COMMAND=""
+ # choose launcher
+ LAUNCHER=""
if [ "$ARCH" == "x86_64" ]; then
ln -sf mcs.bin.x86_64 mcs
cp StardewValley.bin.x86_64 StardewModdingAPI.bin.x86_64
- COMMAND="./StardewModdingAPI.bin.x86_64 $@"
+ LAUNCHER="./StardewModdingAPI.bin.x86_64 $@"
else
ln -sf mcs.bin.x86 mcs
cp StardewValley.bin.x86 StardewModdingAPI.bin.x86
- COMMAND="./StardewModdingAPI.bin.x86 $@"
+ LAUNCHER="./StardewModdingAPI.bin.x86 $@"
+ fi
+
+ # get cross-distro version of POSIX command
+ COMMAND=""
+ if command -v command 2>/dev/null; then
+ COMMAND="command -v"
+ elif type type 2>/dev/null; then
+ COMMAND="type"
fi
- # open terminal
- if command -v x-terminal-emulator 2>/dev/null; then
- x-terminal-emulator -e "$COMMAND"
- elif command -v gnome-terminal 2>/dev/null; then
- gnome-terminal -e "$COMMAND"
- elif command -v xterm 2>/dev/null; then
- xterm -e "$COMMAND"
- elif command -v konsole 2>/dev/null; then
- konsole -e "$COMMAND"
- elif command -v terminal 2>/dev/null; then
- terminal -e "$COMMAND"
+ # open SMAPI in terminal
+ if $COMMAND x-terminal-emulator 2>/dev/null; then
+ x-terminal-emulator -e "$LAUNCHER"
+ elif $COMMAND gnome-terminal 2>/dev/null; then
+ gnome-terminal -e "$LAUNCHER"
+ elif $COMMAND xterm 2>/dev/null; then
+ xterm -e "$LAUNCHER"
+ elif $COMMAND konsole 2>/dev/null; then
+ konsole -e "$LAUNCHER"
+ elif $COMMAND terminal 2>/dev/null; then
+ terminal -e "$LAUNCHER"
else
- $COMMAND
+ $LAUNCHER
fi
fi