AppImageSpec icon indicating copy to clipboard operation
AppImageSpec copied to clipboard

Use $XDG_DATA_HOME instead of hardcoded $HOME/.local/share

Open kossebau opened this issue 7 years ago • 8 comments

kossebau avatar Dec 30 '18 21:12 kossebau

I think we cannot retroactively change this without negatively affecting users because existing scripts are already relying on $HOME/.local/share.

https://github.com/search?utf8=%E2%9C%93&q=%22%24HOME%2F.local%2Fshare%2F%24VENDORPREFIX%2Fno_desktopintegration%22&type=Code

At least 56 projects are already relying on the currently specified location. (Gosh, do I love GitHub full text search - how cool is it that you can check if you break something in advance.)

Using $HOME/.local/share also makes the code easier and less error-prone (I have to admit that I dislike configurability because it adds complexity and makes the testing matrices larger).

probonopd avatar Dec 30 '18 21:12 probonopd

I understand the little risk this change might bring.

But I would hope that those 56 projects are actively developed and might release new versions which have adapted that check. I have not seen XDG_DATA_HOME set that often, so chance that users will be affected might be low (they might have complained already otherwise, given that "broken software looks in the wrong place and ignores XDG_DATA_HOME").

Using the hard-coded $HOME/.local/share instead of the specified variable, which is otherwise well respected in lots of code, sends a bad signal IMHO to everyone one wants to work together on new specifications in the future :(

So I would rather go and fix the AppImage spec to comply with the XDG spec in this early phase, before a first released version of the spec has been released. After all, right now the spec is a draft, or?

kossebau avatar Dec 30 '18 22:12 kossebau

After all, right now the spec is a draft, or?

There you have a point. For reasons exactly like this.

Can we have it check both places?

probonopd avatar Dec 30 '18 22:12 probonopd

+1 for following the XDG Base Directory Specification. By the way, the spec says:

If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

So switching to $XDG_DATA_HOME and specifying $HOME/.local/share as a fallback should do the trick.

shoogle avatar Dec 31 '18 23:12 shoogle

I am with @kossebau here, the change shouldn't significantly break stuff. Many tools using AppImages use XDG_DATA_HOME already.

TheAssassin avatar Jan 01 '19 01:01 TheAssassin

Can we explicitly add a pointer to

If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used

@kossebau? Just to ensure that implementers don't forget this important detail. Thanks!

probonopd avatar Jan 01 '19 13:01 probonopd

@probonopd just add a link to the XDG spec, as that's defined by them, and that way the information doesn't look like an invention of us.

TheAssassin avatar Jan 02 '19 14:01 TheAssassin

Yes, something like "Please especially note that as per the XDG spec, If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used".

probonopd avatar Jan 02 '19 14:01 probonopd

I voice my support for this, many appimage related applications already support the XDG spec, and at AM we even went beyond and started supporting $XDG_BIN_HOME even though it is not in the spec.

It should be as simple as changing this, for example changing:

$HOME/.local/share/appimagekit/no_desktopintegration

for

${XDG_DATA_HOME:-$HOME/.local/share}/appimagekit/no_desktopintegration

No need to make a separate line for each instance where a XDG variable is applicable.

Samueru-sama avatar Aug 08 '24 07:08 Samueru-sama