conf: add some properties in the conf

Add the path, prefix and name in the config properties.
This commit is contained in:
Wim Taymans 2022-02-01 15:55:17 +01:00
parent 2b569861b1
commit 50de4b1886

View file

@ -350,7 +350,8 @@ error:
return res;
}
static int conf_load(const char *path, struct pw_properties *conf)
static int conf_load(const char *path, const char *prefix, const char *name,
struct pw_properties *conf)
{
char *data;
struct stat sbuf;
@ -371,6 +372,10 @@ static int conf_load(const char *path, struct pw_properties *conf)
pw_properties_update_string(conf, data, sbuf.st_size);
munmap(data, sbuf.st_size);
pw_properties_set(conf, "config.path", path);
pw_properties_set(conf, "config.prefix", prefix);
pw_properties_set(conf, "config.name", name);
return 0;
error_close:
@ -392,8 +397,7 @@ int pw_conf_load_conf(const char *prefix, const char *name, struct pw_properties
pw_log_debug("%p: can't load config '%s': %m", conf, path);
return -ENOENT;
}
return conf_load(path, conf);
return conf_load(path, prefix, name, conf);
}
SPA_EXPORT
@ -410,8 +414,7 @@ int pw_conf_load_state(const char *prefix, const char *name, struct pw_propertie
pw_log_debug("%p: can't load config '%s': %m", conf, path);
return -ENOENT;
}
return conf_load(path, conf);
return conf_load(path, prefix, name, conf);
}
/* context.spa-libs = {