Allow starting the game from any directory.

Started by letharion, February 18, 2014, 06:43:01 PM

Previous topic - Next topic

letharion

The current shell script starts the "from the current directory", like this:
./$GAMEFILE
this is fine in itself, but fails if my current working directory for some reason is not the directory of the gamefile.

If the shell script were to begin with:
cd `dirname $0`
it would change into the appropriate directory by itself.

dirname prints the directory of it's argument, and $0 is the file being executed.

Please consider adding this. :)

(Yes, some people really are weird enough that they use the terminal to start their stuff, and this tweak is helpful to us ;) )

daft73

#1
 ::)learn something new everyday

harpo99999

daft73, from the exact wording of the issue, I (as a windows computer support tech) got the impression that letharion is a linux user and not a windows user

daft73

Quote from: harpo99999 on February 21, 2014, 04:36:41 PM
daft73, from the exact wording of the issue, I (as a windows computer support tech) got the impression that letharion is a linux user and not a windows user
Gotcha.. ;D :-X

Tynan

OK. The current script is this:

#!/bin/bash
# Launcher for the Linux version of RimWorld

# Getting game executable name.
GAMEFILE=`ls | egrep x86$`

# Checking if OS is 32 or 64 bits and adjusting the game executable name accordingly.
OSVERSION=`uname -m`
if [[ $OSVERSION == "x86_64" ]]
    then GAMEFILE=${GAMEFILE}_64
fi

#Puts the game executable as... executable if not the case.
if [ ! -x $GAMEFILE ]
    then chmod +x $GAMEFILE
fi

#If this is a dev version, we want to activate logs.
if [[ $GAMEFILE == *Dev* ]]
    then LOG="-logfile /tmp/rimworld_log"
    else LOG=""
fi

#Locale resetting (important for Ubuntu players who are not native speakers of English) and launching the game.
LC_ALL=C ./$GAMEFILE $LOG


What should it look like, exactly? (I am not a Linux expert).
Tynan Sylvester - @TynanSylvester - Tynan's Blog