OSDN Git Service

ucm: config - substitute File string to allow variables in include
authorJaroslav Kysela <perex@perex.cz>
Tue, 19 May 2020 13:09:47 +0000 (15:09 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 25 May 2020 17:20:53 +0000 (19:20 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/ucm/ucm_include.c

index cd8fb57..d1be28f 100644 (file)
@@ -44,6 +44,7 @@ static int include_eval_one(snd_use_case_mgr_t *uc_mgr,
                            snd_config_t **after)
 {
        const char *file;
+       char *s;
        int err;
 
        *result = NULL;
@@ -71,11 +72,14 @@ static int include_eval_one(snd_use_case_mgr_t *uc_mgr,
                return -EINVAL;
        }
 
-       return uc_mgr_config_load_file(uc_mgr, file, result);
+       err = uc_mgr_get_substituted_value(uc_mgr, &s, file);
+       if (err < 0)
+               return err;
+       err = uc_mgr_config_load_file(uc_mgr, s, result);
+       free(s);
+       return err;
 }
 
-
-
 #if 0
 static void config_dump(snd_config_t *cfg)
 {