conf: try to load state from where we saved it

When XDG_STATE_HOME is unset, we save in $HOME/.local/state/pipewire,
so try to first load the state file from there as well before we
try to fall back to the old XDG_CONFIG_HOME location.
This commit is contained in:
Wim Taymans 2021-08-09 09:47:58 +02:00
parent 55c264d2a5
commit 7fda66142b

View file

@ -187,6 +187,13 @@ static int get_state_path(char *path, size_t size, const char *prefix, const cha
dir = result ? result->pw_dir : NULL; dir = result ? result->pw_dir : NULL;
} }
if (dir != NULL) { if (dir != NULL) {
const char *paths[] = { dir, ".local", "state", "pipewire", prefix, name, NULL };
if (make_path(path, size, paths) == 0 &&
access(path, R_OK) == 0)
return 1;
}
if (dir != NULL) {
/* fallback for old XDG_CONFIG_HOME */
const char *paths[] = { dir, ".config", "pipewire", prefix, name, NULL }; const char *paths[] = { dir, ".config", "pipewire", prefix, name, NULL };
if (make_path(path, size, paths) == 0 && if (make_path(path, size, paths) == 0 &&
access(path, R_OK) == 0) access(path, R_OK) == 0)