acp: Respect XDG base directory spec when loading configs

Backport from Pulseaudio. Reimplement get_data_path. We'll look for the
override files similarly as we do for other config files
(XDG_CONFIG_HOME then /etc then install location), instead of looking at
the Pulseaudio locations ~/.local/share/pulseaudio etc.

Upstream commits:

From: SimonP <simonp.git@gmail.com>

alsa-mixer: Respect XDG base directory spec when loading profile sets

Try $XDG_DATA_HOME, then $XDG_DATA_DIRS, and finally fall back to old behaviour.

From: SimonP <simonp.git@gmail.com>

alsa-mixer: Respect XDG base directory spec when loading path configs

Try $XDG_DATA_HOME, then $XDG_DATA_DIRS, and finally fall back to old
behaviour (prefix-defined directory).

core-util: Ignore non-absolute XDG base dirs

These are invalid per the spec.
This commit is contained in:
Pauli Virtanen 2023-11-08 21:22:42 +02:00 committed by Wim Taymans
parent 3bbd1e66d2
commit 636a9c611d
4 changed files with 90 additions and 37 deletions

View file

@ -214,6 +214,7 @@ typedef enum pa_log_level {
PA_LOG_NOTICE = 2, /* Notice messages */
PA_LOG_INFO = 3, /* Info messages */
PA_LOG_DEBUG = 4, /* Debug messages */
PA_LOG_TRACE = 5,
PA_LOG_LEVEL_MAX
} pa_log_level_t;
@ -245,6 +246,7 @@ static inline PA_PRINTF_FUNC(5, 6) void pa_log_level_meta(enum pa_log_level leve
#define pa_log_notice(fmt,...) pa_logl(PA_LOG_NOTICE, fmt, ##__VA_ARGS__)
#define pa_log_info(fmt,...) pa_logl(PA_LOG_INFO, fmt, ##__VA_ARGS__)
#define pa_log_debug(fmt,...) pa_logl(PA_LOG_DEBUG, fmt, ##__VA_ARGS__)
#define pa_log_trace(fmt,...) pa_logl(PA_LOG_TRACE, fmt, ##__VA_ARGS__)
#define pa_log pa_log_error
#define pa_assert_se(expr) \
@ -677,6 +679,8 @@ static inline char *pa_readlink(const char *p) {
#endif
}
char *get_data_path(const char *data_dir, const char *data_type, const char *fname);
#include <spa/support/i18n.h>
extern struct spa_i18n *acp_i18n;