summaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c8
1 files changed, 8 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);