[gnome-color-manager] Ensure ~/.color/icc exists at startup. Fixes #566275
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Ensure ~/.color/icc exists at startup. Fixes #566275
- Date: Thu, 18 Feb 2010 09:14:45 +0000 (UTC)
commit ecca42a063aa6e8b43882a361d5f690968bf69cc
Author: Richard Hughes <richard hughsie com>
Date: Wed Feb 17 22:09:47 2010 +0000
Ensure ~/.color/icc exists at startup. Fixes #566275
src/gcm-profile-store.c | 1 +
src/gcm-utils.c | 23 +++++++++++++++++++++++
src/gcm-utils.h | 2 ++
3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-profile-store.c b/src/gcm-profile-store.c
index c3b2c15..ffa803b 100644
--- a/src/gcm-profile-store.c
+++ b/src/gcm-profile-store.c
@@ -413,6 +413,7 @@ gcm_profile_store_add_profiles (GcmProfileStore *profile_store)
/* get Linux per-user profiles */
path = g_build_filename (g_get_home_dir (), ".color", "icc", NULL);
+ gcm_utils_mkdir_with_parents (path, NULL);
gcm_profile_store_add_profiles_for_path (profile_store, path);
g_free (path);
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index c75c13b..7fbad67 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -235,6 +235,29 @@ gcm_utils_ensure_printable (gchar *text)
}
/**
+ * gcm_utils_mkdir_with_parents:
+ **/
+gboolean
+gcm_utils_mkdir_with_parents (const gchar *filename, GError **error)
+{
+ gboolean ret;
+ GFile *file = NULL;
+
+ /* ensure desination exists */
+ ret = g_file_test (filename, G_FILE_TEST_EXISTS);
+ if (!ret) {
+ file = g_file_new_for_path (filename);
+ ret = g_file_make_directory_with_parents (file, NULL, error);
+ if (!ret)
+ goto out;
+ }
+out:
+ if (file != NULL)
+ g_object_unref (file);
+ return ret;
+}
+
+/**
* gcm_utils_mkdir_for_filename:
**/
gboolean
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 8110276..cbf60c7 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -50,6 +50,8 @@
gboolean gcm_utils_mkdir_for_filename (const gchar *filename,
GError **error);
+gboolean gcm_utils_mkdir_with_parents (const gchar *filename,
+ GError **error);
gboolean gcm_utils_mkdir_and_copy (const gchar *source,
const gchar *destination,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]