BUG:Symlinking the game in Linux breaks my Desktop

Discuss problems related to FTL here. If you are having a problem or experiencing a bug PLEASE READ THE "MUST READ" POST.
ctreb
Posts: 1
Joined: Sat Mar 28, 2015 1:30 am

BUG:Symlinking the game in Linux breaks my Desktop

Postby ctreb » Sat Mar 28, 2015 2:56 am

This is a known issue with the startup script, but surprisingly no one has reported the nasty side effects.

This post from 2 1/2 years ago has the solution which is near enough to exactly the one that I came up with, as it used code from the script that it calls (which gets it right).
http://www.ftlgame.com/forum/viewtopic.php?f=9&t=2083&p=7523&sid=ad323a11f04c6a4aaa6bf50153ea8585&sid=ad323a11f04c6a4aaa6bf50153ea8585#p7523

The script is, to put it politely, rather rudimentary. There are exactly 2 lines of code with zero error checking.

Code: Select all

# enter the game directory
cd ./data
# run FTL
./FTL "$@"


Symlinking this file will assume that the current path is the same as the link, the directory will not change to ./data because its not there, and ./FTL will cause this script to re-run itself ad-infinitum until the OS runs out of processes and prevents anything else running. From here you can only close windows and logout or reboot. If you're in a terminal then Ctrl-C does work.

KDE throws out a very good error message when I try to open a file manger window:

Code: Select all

KDEInit could not launch '/bin/dolphin': Unable to create new process. The system may have reached the maximum number of processes possible or the maximum number of processes that you are allowed to use has been reached.


Symlinking is something that I assume most Linux users do and is enabled in most file manager GUIs so this should be fixed IMHO. It must be frustrating a few people that don't know any better.

Wrapping an if statement around it all would be good too, just in case us users do anything else stupid...

Code: Select all

#!/bin/bash

here="$(dirname "$(readlink -f "$(which "$0")")")"

# enter the game directory
if [ -d "$here/data" ]; then
    cd "$here/data"
else
    echo "data directory not found"
    exit 1
fi
# run FTL
./FTL "$@"


Thanks for listening. I bought the game quite a while ago but I'm just getting into it now and having a blast!

Cheers

PS: The MUST READ post told me to report bugs at http://www.GetSatisfaction.com/FTLgame , but its broke.