From 10d6972d37355198a63309142ae9875fdcc222f6 Mon Sep 17 00:00:00 2001 From: infirit Date: Wed, 19 Nov 2014 15:20:34 +0100 Subject: use g_get_user_config_dir instead of using .config/mate Also provide an automatic migration mechanism. Based on FR commit: 7fd220a834f16b260da8f5ddc1250c43b9dbefd8 From: Paolo Bacchilega --- src/file-utils.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/file-utils.c') diff --git a/src/file-utils.c b/src/file-utils.c index 3b33480..7e1f170 100644 --- a/src/file-utils.c +++ b/src/file-utils.c @@ -1232,6 +1232,29 @@ get_home_relative_file (const char *partial_uri) } +GFile * +get_user_config_subdirectory (const char *child_name, + gboolean create_child) +{ + char *full_path; + GFile *file; + GError *error = NULL; + + full_path = g_strconcat (g_get_user_config_dir (), "/", child_name, NULL); + file = g_file_new_for_path (full_path); + g_free (full_path); + + if (create_child && ! make_directory_tree (file, 0700, &error)) { + g_warning ("%s", error->message); + g_error_free (error); + g_object_unref (file); + file = NULL; + } + + return file; +} + + const char * remove_host_from_uri (const char *uri) { -- cgit v1.2.1