mirror of
https://github.com/aome510/spotify-player.git
synced 2026-04-26 01:15:55 +03:00
[PR #357] Use XDG specification environment variables #1667
Labels
No labels
bug
documentation
enhancement
good first issue
help wanted
pull-request
question
third-party
third-party
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-player#1667
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/aome510/spotify-player/pull/357
Author: @LucasFA
Created: 2/5/2024
Status: 🔄 Open
Base:
master← Head:xdg-config📝 Commits (1)
5165c33feat!: use XDG spec environment variables📊 Changes
2 files changed (+19 additions, -6 deletions)
View changed files
📝
README.md(+2 -2)📝
spotify_player/src/config/mod.rs(+17 -4)📄 Description
I noticed a while back that the default XDG base specification locations are hard coded. This PR changes the project to use the corresponding environment variables.
This is a now obsolete message, but let's keep it for context
This was when considering to use the dirs-next crate: ~~As I comment in the commit message~~, it is a BREAKING CHANGE for users with the XDG_CONFIG_HOME variable set to one different from the default. Note that while the spec seems relatively Linux-centric, the dirs-next crate also uses recommended guidelines in both mac OS and Windows and so would ~~be breaking for possibly absolutely~~ affect all users. See the table:Obviously breaking all users' config is breaking for any release, so I thought about renaming the current files to whatever they would become after the new location, but that might just break other users, for all I know. (I'm looking at you, NixOS)
Then this is some contextual information from what other projects do:
It seem that while the convention is clearly defined in Linux, the situation is not so clear in MacOS, and somewhat in Windows. In Mac, ome people strongly prefer the platform recommended locations, and other strongly prefer the XDG ~/.config location. There's precendent: https://github.com/rust-lang/rfcs/pull/1615#issuecomment-221361170, https://github.com/dirs-dev/directories-rs/issues/47. Neovim seems to clump all Unix together, so they also use ~/.config for MacOS. On the opposite end is the `dirs-next` crate, which doesn't honor the XDG environment variables in MacOS: [docs](https://docs.rs/dirs-next/2.0.0/dirs_next/fn.cache_dir.html)
Current status
This PR just detects if the XDG_CONFIG_HOME and XDG_CACHE_HOME environment variable are set. For compatibililty, if XDG_CONFIG_HOME is set but the old location exists, keep current behaviour. Cache is migrated to XDG_CACHE_HOME always.
Given that the cache folder is not routinely accessed, this should not affect any users negatively.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.