Merge pull request #12992 from pchote/launch-game-dot-sh
Overhaul launch-game.sh for OS X/Linux/POSIX
This commit is contained in:
@@ -1,9 +1,36 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Note: this relies on the non-standard -f flag implemented by gnu readlink
|
MODLAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||||
mono OpenRA.Game.exe Engine.LaunchPath="$(readlink -f $0)" "$@"
|
|
||||||
if [ $? != 0 -a $? != 1 ]
|
# Prompt for a mod to launch if one is not already specified
|
||||||
|
MODARG=''
|
||||||
|
if [ z"${*#*Game.Mod}" = z"$*" ]
|
||||||
then
|
then
|
||||||
ZENITY=`which zenity` || echo "OpenRA needs zenity installed to display a graphical error dialog. See ~/.openra. for log files."
|
if which zenity > /dev/null
|
||||||
$ZENITY --question --title "OpenRA" --text "OpenRA has encountered a fatal error.\nLog Files are available in ~/.openra." --ok-label "Quit" --cancel-label "View FAQ" || xdg-open https://github.com/OpenRA/OpenRA/wiki/FAQ
|
then
|
||||||
|
TITLE=$(zenity --forms --add-combo="" --combo-values="Red Alert|Tiberian Dawn|Dune 2000|Tiberian Sun" --text "Select mod" --title="" || echo "cancel")
|
||||||
|
if [ "$TITLE" = "cancel" ]; then exit 0
|
||||||
|
elif [ "$TITLE" = "Tiberian Dawn" ]; then MODARG='Game.Mod=cnc'
|
||||||
|
elif [ "$TITLE" = "Dune 2000" ]; then MODARG='Game.Mod=d2k'
|
||||||
|
elif [ "$TITLE" = "Tiberian Sun" ]; then MODARG='Game.Mod=ts'
|
||||||
|
else MODARG='Game.Mod=ra'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Please provide the Game.Mod=\$MOD argument (possible \$MOD values: ra, cnc, d2k, ts)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Launch the engine with the appropriate arguments
|
||||||
|
mono OpenRA.Game.exe Engine.LaunchPath="$MODLAUNCHER" $MODARG "$@"
|
||||||
|
|
||||||
|
# Show a crash dialog if required
|
||||||
|
if [ $? != 0 ] && [ $? != 1 ]
|
||||||
|
then
|
||||||
|
if which zenity > /dev/null
|
||||||
|
then
|
||||||
|
zenity --question --title "OpenRA" --text "OpenRA has encountered a fatal error.\nLog Files are available in ~/.openra." --ok-label "Quit" --cancel-label "View FAQ" || xdg-open https://github.com/OpenRA/OpenRA/wiki/FAQ
|
||||||
|
else
|
||||||
|
printf "OpenRA has encountered a fatal error.\n -> Log Files are available in ~/.openra\n -> FAQ is available at https://github.com/OpenRA/OpenRA/wiki/FAQ\n"
|
||||||
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user