linux: launcher script v2. Add another check and replace test by '[ ]' for portability

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4299 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2011-02-14 19:02:48 +00:00
parent 3f9e72f0b8
commit 11b5efc631
1 changed files with 14 additions and 7 deletions

View File

@ -5,19 +5,26 @@
# Rationale: There is no guarantee on the directory when PCSX2 is launched from a shortcut.
# This behavior trigger the first time wizards everytime...
if test $0 = "launch_pcsx2_linux.sh" || $0 = "sh" || $0 = "bash" ; then
echo "Error the script was directly 'called'"
echo "Use either /absolute_path/launch_pcsx2_linux.sh or ./relative_path/launch_pcsx2_linux.sh"
exit 1
fi
current_script=$0
[ $current_script = "launch_pcsx2_linux.sh" ] || [ $current_script = "sh" ] || [ $current_script = "bash" ] && \
echo "Error the script was directly 'called'" && \
echo "Use either /absolute_path/launch_pcsx2_linux.sh or ./relative_path/launch_pcsx2_linux.sh" && exit 1;
# Note: sh (dash on debian) does not support pushd, popd...
# Save current directory
PWD_old=$PWD
# Go to the script directory
chdir `dirname $0`
./pcsx2
chdir `dirname $current_script`
if [ -e pcsx2 ] ; then
./pcsx2
else
echo "Error PCSX2 not found"
echo "Maybe the script was directly 'called'"
echo "Use either /absolute_path/launch_pcsx2_linux.sh or ./relative_path/launch_pcsx2_linux.sh"
exit 1
fi
# Go back to the old directory
chdir $PWD_old