I'm setting up a Kerbal Space Program install on Ubuntu Mate 16.04, and one of the mods I have installed (Principia -- makes the game gravity act like real gravity) can't find its principia.so
unless the working directory is the same one the game is installed in.
Unfortunately, I learned a few months ago, when I installed 16.04 MATE, that the Mate desktop launchers don't support compound commands (like cd /home/username/KSP-RO_1.3.1 && KSP.x86_64
), and seem to offer no provision to change the working directory from the launcher properties. KDE launchers do (or did, in 14.04; I haven't used Kubuntu 16.04 much) allow specifying a working directory; is there a way to do so in a MATE launcher?
The simplest workaround I can think of is to write a wrapper script:
Save the script as
~/bin/run_ksp.sh
, make it script executable (chmod 755 ~/bin/run_ksp.sh
and then use a launcher pointing to that script instead.Just as I finished posting the question, one of the sidebar links popped up this 2011 question which addresses a very similar problem with entirely different software.
Simply put, if you open the .desktop file created by the Create Launcher process with a text editor (I used Pluma, because it comes preinstalled on Ubuntu MATE 16.04), you can alter the information stored in the file in ways the Launcher creator won't allow -- including adding a
Path=
key to let your launcher specify a working directory in which to launch the specified executable.I tried doing this, and it works. There's no reason one couldn't use a wrapper script as in Terdon's answer, but to me, this seems a little cleaner -- and a bit more likely to be salvageable in the case of an unexpected reinstall situation (I normally install in a manner that will leave my previous
/home
folder(s) intact, so I can salvage stored items from them).It's likely that this works because MATE is derived from Gnome 2, which was the default desktop environment for Ubuntu back around 10.04. It's not really a replacement for allowing the user to specify a working directory during launcher creation, but it gets the job done.