treesheets
treesheets copied to clipboard
Please use $XDG_CONFIG_HOME on unix
And other XDG dirs: https://www.freedesktop.org/wiki/Software/xdg-user-dirs/ https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Use them where? For what? How universal are these things on Linux? I have not heard about any of this before.
Quite widely used. Take a look in your $HOME/.config/ (the default location for $XDG_CONFIG_HOME). There must be an almost infinite amount of things I haven't heard of either.
It is rather standardized in systemd-based distributions (which nowadays translates to Debian/RHEL/SUSE and their derivatives like Ubuntu/Fedora/CentoOS/etc).
Would be nice to reduce clutter in the home folder. It is roughly analogous to using %APPDATA%
on Windows instead of dumping files on the desktop.
Some examples:
- git uses $XDG_CONFIG_HOME (the "fairly recently" line was written in 2012).
- All currently maintained GNOME and KDE apps should be using it for a few years now.
- VSCode uses $HOME/.config (proper support for XDG still pending).
A typical order of locations to check would be:
-
$XDG_CONFIG_HOME/TreeSheets/
(with the file being named simplyconfig
); - if
$XDG_CONFIG_HOME
is undefined,$HOME/.config/Treesheets/
; - if above two locations do not exist, use
~/.TreeSheets
I am not that familiar with wxWidget but it appears to support using XDG dirs since 3.1.1.
Well, I don't determine the path or filename of the config data on Linux, that is all in wxWidgets. On Windows it goes into the registry, for example. So sounds like if you would build with 3.1.1 you'd automatically get the functionality requested?
The new TreeSheets CI builds with tip of tree wxWidgets, so should be more recent than 3.1.1: https://github.com/aardappel/treesheets/actions/runs/116985613 Not sure about the Snap build etc.
Using Linux TreeSheets g++-9 build from the above link, it still creates ~/.TreeSheets
(I deleted it to simulate first run). Maybe you need to set this as it's stated
This [classic file layout] is the default behaviour for compatibility reasons.
Let's see if this helps (untested): https://github.com/aardappel/treesheets/commit/c72a884a5109dd5804333aae7eb7674f5ae35c8f
CI builds: https://github.com/aardappel/treesheets/actions/runs/118487009
Ok, new version of that same commit, since our Travis CI isn't set up to build with versions that new: https://github.com/aardappel/treesheets/commit/6f1f5b272b9e4818a92f6511f615988a8e205559
Ok, with Linux TreeSheets g++-9 build 6f1f5b2, the config file is now created at $XDG_CONFIG_HOME/TreeSheets.conf
It ignores if ~/.TreeSheets
already exists and always creates at the new location. IMO that is an acceptable breaking change for bleeding edge software like TS, and preferable for new TS users on mainstream distros in the long run.
However, with TreeSheets-6f1f5b2-x86_64.AppImage, it still creates the config file at ~/.TreeSheets
.
I think in order to provide a migration path, existing configs should be looked up in both the old location and $XDG_CONFIG_HOME before deciding to create a new config in $XDG_CONFIG_HOME.
@jn64 Yes, I was thinking this means Linux users will have their config reset. I guess they can manually move it to the new location if needed. TreeSheets is not that rich in config options that it will matter for most.
Funny you call TreeSheets "bleeding edge", it's been in development since 2008 and has been largely stable for the last 5+ years.
Not sure why the AppImage still does the old thing.. presumably whatever code wxWidgets has to detect XDG location doesn't work inside an AppImage? So far my impression of AppImage is that quite a lot of things work differently from a regular Linux environment. @probonopd may know why. AppImage created here if anyone wants to improve it: https://github.com/aardappel/treesheets/blob/6f1f5b272b9e4818a92f6511f615988a8e205559/.travis.yml#L89-L117
@ptman if you look at the code in https://github.com/aardappel/treesheets/commit/6f1f5b272b9e4818a92f6511f615988a8e205559 you'll see that I have absolutely no control over how these config locations are used.. There's no option to look up in both.
Well if "bleeding edge" is the wrong word I just mean it's a "dev version" and I accept the risk that such changes can happen. Thanks for the change!
Not sure why the AppImage still does the old thing..
https://github.com/aardappel/treesheets/releases/tag/continuous is working or me (it launches). What exactly would you like to see changed with the AppImage?
The AppRun file inside the TreeSheets AppImage exports XDG_DATA_DIRS
as we can see:
me@host:~$ Downloads/TreeSheets-6f1f5b2-x86_64.AppImage --appimage-extract AppRun
squashfs-root/AppRun
me@host:~$ strings squashfs-root/AppRun | grep XDG_
XDG_DATA_DIRS
XDG_DATA_DIRS=%s/usr/share/:%s
The code responsible for this is at
https://github.com/AppImage/AppImageKit/blob/fef038a6283701f6976589bf7becf975b020d453/src/AppRun.c#L180-L181
Would you like to see another behavior?
Hi @probonopd, the issue is about where TreeSheets puts its config file (via wxWidgets).
-
Previously, it puts it at
~/.TreeSheets
-
After 6f1f5b2, the normal Linux builds of TreeSheets put it at
$XDG_CONFIG_HOME/TreeSheets.conf
. This is the desired behaviour and all is well. -
Except, the AppImage still puts it at
~/.TreeSheets
. So the question is why isn't it behaving like 2).
Note: XDG_CONFIG_HOME not XDG_DATA_DIRS
Are you sure that XDG_CONFIG_HOME
is set to something?
In my env yes (because I've had it set for a long time and other programs work as expected). If you mean in the AppImage I don't know.
At any rate 2) happened, and my environment didn't change between 2) and 3).