Open 532910 opened 5 years ago
This is the default location for all electron apps: https://github.com/electron/electron/blob/master/docs/api/app.md#appsetpathname-path
Look like riot should workaround this with app.setPath("cache", "~/.cache")
Indeed, on linux, Riot creates at least three cache directories under ~/.config/Riot: Cache, Code Cache, and GPUCache. These should be under ~/.cache/Riot instead. They're wasting space in my backup archives, and circumventing the tmpfs I use for cache filesystems.
what is the problem to workaround the path with app.setPath("cache", "~/.cache")
?
Is there any update?
No, otherwise you would have seen it here.
what's wrong to workaround with app.setPath
?
Best off asking the Electron team that, they must have a reason for not using it.
I'd imagine ~/.cache
isn't available on absolutely every single supported Linux environment.
.cache
and .config
are both from the same specification:
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
https://wiki.archlinux.org/index.php/XDG_Base_Directory
Doesn't mean that .config
isn't also specified by some other standard.
As I already said, this would be best done upstream.
According to https://github.com/electron/electron/issues/8124 setting cache
dir won't fix it anyway:
Cache data is written to
userData
dir instead ofcache
dir
Cache must be in
~/.cache
not in~/.config/Riot/Cache
Please read the XDG Base Dir Specification. If the variables are set the path must be derived from them. Not always is it ~/.cache
.
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
This is the default location for all electron apps: https://github.com/electron/electron/blob/master/docs/api/app.md#appsetpathname-path
It doesn't make it alright.
Look like riot should workaround this with
app.setPath("cache", "~/.cache")
Yeah, but instead read the variable and only fallback if it isn't set:
$XDG_CACHE_HOME defines the base directory relative to which user-specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.
(From the specification)
they must have a reason for not using it.
They probably did not read the specification or don't care about standards.
Please read the XDG Base Dir Specification. If the variables are set the path must be derived from them. Not always is it
~/.cache
.
Comment updated, is it better now? It doesn't change anything anyway, since the main message was that it shouldn't be in ~/.config
.
This is the default location for all electron apps
Just because they don't read standards does not mean it has to be reproduced.
$XDG_CONFIG_HOME is supposed to be a folder you can simply copy to new machines or sync to other machines.
This likely breaks badly if I try to sync with other machines.
Seems to have been solved in upstream, https://github.com/electron/electron/pull/33554 has been merged and closed.
Great! Though the PR says it "allow[s] customizing browser data location" and goes on to explain how one (i.e. electron dev) can actually use that. As such, I guess as for Element there is still something to do, i.e. actually configure it to use the "correct" locations… (still wonder why they don't use/include the proper defaults then in Electron upstream?)
(still wonder why they don't use/include the proper defaults then in Electron upstream?)
The problem seems to be that Chromium doesn't seem to want to adhere to XDGBDS and just packs everything into this single directory (1 2). So the Electron devs were only able to separate Session & User data from one and another. So Electron cannot just move these directories to $XDG_CACHE_HOME as then also Cookies & Web Storage would be stored there as well and some Electron apps store valuable data there.
As an example, Trilium Notes uses its own data directory, so doesn't depend on Cookies/Web Storage, which should enable it to just treat the Electron directories as cache.
Sadly for this, Element seems to use the Cookies & Web Storage and so cannot just easily separate them.
Cache must not be stored in
~/.config/Riot/Cache
. There is~/.cache
or$XDG_CACHE_HOME
for cache. https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html