With the desktop file for linux (XDG desktop file), there's no obvious way I can see to set a current/working directory, which may be a problem for DebugConsole and its log/config files. It does have a way to pass variables to whatever's being launched.
It seems the working directory (at least for xfce4) is $HOME, which is undesirable for the conf an log files.
This is how I've done a 'user local' install manually.
For my test, I've copied and renamed OoJSC256x256.png to $HOME/.local/share/icons/hicolor/256x256/apps/OoliteDebugConsole2-icon.png
I'm using a "shim" script to handle setting the working directory and launching the debug console. This will check if the variable OoliteDebugConsole2_conf exists, and use that as the config/log directory, else it will use a hard wired default of $HOME/.OoliteDebugConsole2 which is of course hidden from plain user view by the leading dot.
Both that script and the debug console executable are in $HOME/.local/bin (I used symlinks to my dev versions)
Code: Select all
ls ~/.local/bin/Oo*
OoliteDebugConsole2 OoliteDebugConsole2.sh
The shim script (OoliteDebugConsole2.sh) is set chmod 755 and looks like this:
Code: Select all
#!/bin/sh
#Wrapper script for OoliteDebugConsole
xit(){ echo "Error: $*" >&2 ; exit 1 ; }
# Set up and cd to the working directory, where the configs and logs should live.
# If we want to have multiple/different ports/configs, this script can be copied
# and tweaked to point elsewhere.
#default
confdir="$HOME/.Oolite/DebugConsole2"
#or get from env (crude)
x="$OoliteDebugConsole2_conf"
[ "x$x" != "x" ] && confdir="$x"
[ -d "$confdir" ] || mkdir "$confdir" ||\
xit "Failed to make config directory $confdir"
cd "$confdir" || xit "Could not change directory to $confdir"
#Now pwd is the config directory, we launch the app.
"$HOME/.local/bin/OoliteDebugConsole2"
As always, it looks better in a context highlighting editor.
The $HOME/.local/share/applications/OoliteDebugConsole2.desktop file:
Code: Select all
[Desktop Entry]
Type=Application
Name=DebugConsole2 for Oolite
GenericName=DebugConsole2 for Oolite
Comment=Debugger for Oolite version 2
Exec=.local/bin/OoliteDebugConsole2.sh
Icon=OoliteDebugConsole2-icon.png
Terminal=false
Categories=Application
I suppose exec should be the full path, but as the desktop pwd seems to be $HOME, I figure realtive is ok here. In production, this ought to do as the Oolite installer does and set a full path.
The good news here is that if we call the wrapper script on it's own, we get the config and logs from $HOME/.Oolite/DebugConsole2 but we can either copy and change the scripts default to have different configs, or call it like this:
Code: Select all
OoliteDebugConsole2_conf=/tmp/test OoliteDebugConsole2.sh
And voila! The config directory is /tmp/test.
To do that in the .desktop file we can tweak the Exec line thus:
Code: Select all
Exec=env OoliteDebugConsole2_conf=/tmp/test .local/bin/OoliteDebugConsole2.sh
So now, to have different configs, we can do it from different desktop files.
The env trick works with desktop launchers creates by right clicking desktop and using 'create launcher', at least in xfce4.
(edit: changed the names in .desktop file to stop it jumping in front of oolite in search selections.. I launch Oolite by invoking the start search via the windoze key, hitting oo, then return. I just fancied a play and got the debugger instead.)
(edit: fixed bad check for env var in shim script)
(edit: changed icon to 256x256 and changed name and location)
(edit: changed default confdir to $HOME/.Oolite/DebugConsole2")
Another issue which is probably in the game itself. If the debugger goes away, the game does not try to reconnect. Should that be an issue on oolite's github?