mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
conf: Allow dynamic top-level config directory
Currently the top-level config directory is specified only via configure script option, and is fixed after that. It's inconvenient when the library is moved to another base directory, or if you want to use a library code (e.g. with $LD_PRELOAD) with the incompatible config setups. This patch allows user to override the top-level config path via the environment varialbe, $ALSA_CONFIG_DIR. For that, a new helper function, snd_config_topdir(), was introduced, and the codes referring to the top config dir have been modified to handle it dynamically. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
f3d2f4046e
commit
516bf057b0
9 changed files with 78 additions and 37 deletions
|
|
@ -299,8 +299,12 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
|
|||
snd_mixer_class_set_private(class, priv);
|
||||
snd_mixer_class_set_private_free(class, private_free);
|
||||
file = getenv("ALSA_MIXER_SIMPLE");
|
||||
if (!file)
|
||||
file = ALSA_CONFIG_DIR "/smixer.conf";
|
||||
if (!file) {
|
||||
const char *topdir = snd_config_topdir();
|
||||
char *s = alloca(strlen(topdir) + strlen("smixer.conf") + 2);
|
||||
sprintf(s, "%s/smixer.conf", topdir);
|
||||
file = s;
|
||||
}
|
||||
err = snd_config_top(&top);
|
||||
if (err >= 0) {
|
||||
err = snd_input_stdio_open(&input, file, "r");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue