Ludeon Forums

RimWorld => General Discussion => Topic started by: letharion on February 18, 2014, 06:43:01 PM

Title: Allow starting the game from any directory.
Post by: letharion on February 18, 2014, 06:43:01 PM
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 ;) )
Title: Re: Allow starting the game from any directory.
Post by: daft73 on February 21, 2014, 01:12:25 PM
 ::)learn something new everyday
Title: Re: Allow starting the game from any directory.
Post by: 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
Title: Re: Allow starting the game from any directory.
Post by: daft73 on February 21, 2014, 05:09:01 PM
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
Title: Re: Allow starting the game from any directory.
Post by: Tynan on February 21, 2014, 05:48:39 PM
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).