fix: respect XDG_CACHE_HOME instead of hardcoding $HOME/.cache#762
Conversation
Up to standards ✅🟢 Issues
|
|
@ymcx Thank you for this! If you have a moment can you sign the commit? |
Alright so I tried to sign the commit as is but it seems like that wasn't possible. I recently moved over to Codeberg and as such I changed my global git credentials to match the new email address while preserving the user.name and the signing key. I figured it would be the easiest to just merge all of the changes in this branch into a new commit that's signed with the new email address. I hope that's okay. |
|
@ymcx that works, thanks |
I have set the XDG_CACHE_HOME environment variable to a location different than the default value of $HOME/.cache. For some odd reason, when trying to launch Trivalent with this configuration by using the provided trivalent.sh script on a vanilla Fedora installition, it fails to launch if $HOME/.cache doesn't exist. The following error gets printed to stdout/stderr:
Creating that directory manually and rerunning the script makes Trivalent launch just fine, even though it doesn't create any temp files in that directory.
I then copied the script from /usr/bin/trivalent to another directory and modified it such that it could be executed from this new location, and for whatever reason, it now launched just fine after having automatically created the hidden cache directory on my home folder.
Anyhow, we shouldn't assume that the cache directory is located at $HOME/.cache on each system, since the XDG spec allows moving its location via the XDG_CACHE_HOME env variable. Using XDG_CACHE_HOME would fix both of the issues mentioned above, i.e. allowing Trivalent to run with a custom cache directory location and in some cases, not creating a new cache directory at the wrong location. As per the spec, we should however default to the old directory in case XDG_CACHE_HOME isn't set.