[Regression] Shellscript for Linux start (eternity.sh) fails in directories with spaces

Issue #12 resolved
NeedMoreCoffee created an issue

The new shell script for starting the program on Linux fails when run from a directory that has spaces in its name. The reason are the missing quotes when setting the variable ROOT:

ROOT=$(dirname $(readlink -f $0))

If we break it down, readlink will return something like:

/home/user/GOG Games/Pillars of Eternity/EternityKeeper/eternity.sh

(which is the default installation path for the GOG version, so probably quite common).

Then dirname will break these apart into this:

$ dirname /home/user/GOG Games/Pillars of Eternity/EternityKeeper/eternity.sh
/home/user
Games
.
Eternity/EternityKeeper

Which will cause everything else that depends on ROOT being set correctly to fail.

The fix is to enclose the directory name in double quotes:

$ dirname "/home/user/GOG Games/Pillars of Eternity/EternityKeeper/eternity.sh"
/home/user/GOG Games/Pillars of Eternity/EternityKeeper

I therefore propose to change the third line of eternity.sh to this:

ROOT=$(dirname "$(readlink -f $0)")

That should fix the problem.

Comments (4)

  1. Log in to comment