Skip to content

Commit

Permalink
Allow installation in a path with whitespaces (#19609)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarboniteKream authored and mugling committed Dec 4, 2016
1 parent 97eeefc commit 0c94833
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cataclysm-launcher
Expand Up @@ -4,8 +4,8 @@ TARGET_FILE=$0
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`

# Iterate down a (possible) chain of symlinks
while [ -L $TARGET_FILE ]
# Iterate down a (possible) chain of symlinks.
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=`readlink $TARGET_FILE`
cd `dirname $TARGET_FILE`
Expand All @@ -14,23 +14,23 @@ done

# Find the physical path and name of target file.
DIR=`pwd -P`
BIN=$(basename $0)
BIN=`basename $0`

cd $DIR || exit $?
cd "$DIR" || exit $?

# If name does not match a binary or is this same script, find the right one
if [ ! -f $BIN ] || [ $BIN = "cataclysm-launcher" ]
if [ ! -f "$BIN" ] || [ "$BIN" = "cataclysm-launcher" ]
then
BIN=
for bin in cataclysm-tiles cataclysm
do
[ -f $bin ] && BIN=$bin && break
[ -f "$bin" ] && BIN="$bin" && break
done
fi

if [ $BIN ]
if [ "$BIN" ]
then
exec ./$BIN
exec "./$BIN"
else
echo "Couldn't find cataclysm game binary in $DIR/"
exit 1
Expand Down

0 comments on commit 0c94833

Please sign in to comment.