@heyjudek :-
This is what I was saying above.
By using the XDG Base Directory specifications - combined with the use of a 'readlink' clause in a launcher script - you can trick any application into thinking that the directory it's in is in fact the user's $HOME directory.....and at first run, it will create all its config files inside that same directory.
Let me give you an example. Here's the 'LAUNCH' script tht I use for a Puppy-portable which uses the LibreOffice AppImage:-
Code:
#!/bin/sh
#
# Launcher for 'portable' LibreOffice...
#
HERE="$(dirname "$(readlink -f "$0")")"
#
XDG_CONFIG_HOME=
#XDG_CACHE_HOME=
#XDG_DATA_HOME=
HOME="$HERE"
#
LD_LIBRARY_PATH=$HERE/:$HERE/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
"$HERE/LibreOffice64" "$@"
The line starting with 'HERE' is the 'readlink' clause; this is what makes the application think that it's running from the normal /home/username directory, and writes the config stuff accordingly.
The clause as written above is a wee bit more complex than the standard read-link commands in the above-linked tutorial, though it's all very straight-forward Bash scripting stuff when it boils down to it. That command, as written, WILL establish ANY directory as the one relative to all the stuff going on inside it.
The next few lines tell the application which specific config directories to create:-
"XDG_CONFIG_HOME" will cause the app to create a primary config directory (this would usually be directly within the $HOME/.config directory)
"XDG_CACHE_HOME" will cause the app to create a directory within $HOME/.cache (if the application uses .cache; not all do)
"XDG_DATA_HOME" equates to stuff that would normally go into $HOME/.local/share
The last line there tells it that the $HOME directory is the one delineated by the readlink variable, i.e., 'HERE'.
In the above example, only the first and last lines are 'active', since LibreOffice AppImages typically create a single directory within $HOME/.config. For this reason, the other two lines are commented out, since LibreOffice doesn't write anything to either of these locations.
Following the specs here at the Arch Linux Wiki (an invaluable source for any Linux information):-
wiki.archlinux.org
.....you can add whatever further directories you know (or think) will be necessary. To be on the 'safe side', you CAN leave them all uncommented, if you wish.
~~~~~~~~~~~~~~~~~~~
You may have noticed the name of the AppImage in the final 'exec' line. Normally, when you obtain AppImages they usually have a much longer and more complicated name, often including a version number and the 'arch' for which they're built.
A little-known fact with AppImages is that you can re-name them to anything you want.....make them much shorter, and easier to remember, and they will STILL fire up. The reason WHY this is possible with AppImages is simple; because the act of clicking on them transfers the executable action to a file inside named 'AppRun'; this is what actually launches the main executable binary within. The AppImage, as you 'see it' when you obtain it is nothing more than a container for the app contents inside it.
When you click on the 'container', this causes the 'AppRun' file to evaluate the contents, unpack everything to a one-time directory created FOR the session within /tmp, assess the specified locations for the expected config files (and create them if they don't already exist), followed by finally launching the app itself once it's satisfied everything is in place. This is why there is frequently a slight - but noticeable - pause with AppImages
before you see anything happen; even with the speed at which modern processors function, all the afore-mentioned activity will take at least a couple of seconds to run through.
Hope that clarifies some of what we've been talking about. I haven't forgotten that spec stuff for the AppImage config creation; as & when I find it, I'll post back back here with the information. Just remember; real life often has to take priority over our favourite subject matter on this forum - in my own case, as a full-time carer for an elderly relative, it's highly unpredictable at the best of times! - so just be patient. I WILL find it, time permitting.
Mike.