diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-04 23:09:41 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-04 23:09:41 (EDT) |
commit | 6208d1f813c2ea5a070d57aaa414fdd370391349 (patch) | |
tree | b53a915d98e2284988546ea18b11dad8a430ad09 /src | |
parent | a5f16087d6d9d0d5e03ef49f1901027505879d4a (diff) | |
download | marquee-6208d1f813c2ea5a070d57aaa414fdd370391349.zip marquee-6208d1f813c2ea5a070d57aaa414fdd370391349.tar.gz marquee-6208d1f813c2ea5a070d57aaa414fdd370391349.tar.bz2 |
mq_config_load(): Build profile directory
And save profile name in mq_config_new().
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 8 | ||||
-rw-r--r-- | src/config.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index b9aa207..9cb48b9 100644 --- a/src/config.c +++ b/src/config.c @@ -203,6 +203,7 @@ mq_config_new(const gchar *profile) config = malloc(sizeof(*config)); + config->profile = g_strdup(profile); config->file_name = g_build_filename(g_get_user_config_dir(), profile, "config", NULL); config->key_file = g_key_file_new(); @@ -215,6 +216,13 @@ mq_config_new(const gchar *profile) gboolean mq_config_load(MqConfig *config) { + gchar *profile_dir; + + profile_dir = g_build_filename(g_get_user_config_dir(), config->profile, + NULL); + g_mkdir_with_parents(profile_dir, 0700); + g_free(profile_dir); + /* TODO: Handle parsing and ENOENT errors differently? */ return g_key_file_load_from_file(config->key_file, config->file_name, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, NULL); diff --git a/src/config.h b/src/config.h index 97e58fa..b37c6bb 100644 --- a/src/config.h +++ b/src/config.h @@ -27,6 +27,7 @@ typedef struct MqConfig MqConfig; #include <glib.h> struct MqConfig { + gchar *profile; gchar *file_name; GKeyFile *key_file; gboolean types_and_cbs_set; |