Skip to content

add support for XDG_DATA_HOME and XDG_STATE_HOME#2447

Open
tmzullinger wants to merge 2 commits intoMusicPlayerDaemon:masterfrom
tmzullinger:more-XDG
Open

add support for XDG_DATA_HOME and XDG_STATE_HOME#2447
tmzullinger wants to merge 2 commits intoMusicPlayerDaemon:masterfrom
tmzullinger:more-XDG

Conversation

@tmzullinger
Copy link

I wanted to use $XDG_STATE_HOME in my config for state_file. I saw the related request for $XDG_DATA_HOME in #263 and decided to attempt adding support for each of them.

I've used $XDG_STATE_HOME in my personal config with this patch, but I have not found a need for $XDG_DATA_HOME personally, so it is only tested by the test suite.

I am not sure if GetAppStateDir() should be present. It might not map as well as GetAppCacheDir() does to the cache directory. I just used state_file "$XDG_STATE_HOME/mpd.state" in my local config, rather than placing a single file in an mpd subdirectory. It might not make any sense to have it in the code, unless we want to default to $XDG_STATE_HOME/mpd/state? The same may be true for GetAppDataDir() but it seems more likely a subdirectory could be useful there.

I'm not particularly skilled with C++, so the code is largely copied from the existing XDG support. Beware of silly bugs. :)

This builds on e8ce417 (Initial support for $HOME and some XDG
variables inside the configuration file, 2025-02-28).

It does not address the request in MusicPlayerDaemon#263 to use $XDG_DATA_HOME as the
home for playlists, but is a step toward it.
This builds on e8ce417 (Initial support for $HOME and some XDG
variables inside the configuration file, 2025-02-28).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant