[gnome-color-manager] Ensure gcm_utils_get_profile_filenames_for_directory() recurses into other subdirectories to get the
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Ensure gcm_utils_get_profile_filenames_for_directory() recurses into other subdirectories to get the
- Date: Thu, 5 Nov 2009 15:03:10 +0000 (UTC)
commit fb438a8ce2ae2f2103c57fdafc30ccffa91a9788
Author: Richard Hughes <richard hughsie com>
Date: Thu Nov 5 15:02:25 2009 +0000
Ensure gcm_utils_get_profile_filenames_for_directory() recurses into other subdirectories to get the Adobe profiles
src/gcm-utils.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 844ee7c..cc71d8e 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -322,6 +322,7 @@ gcm_utils_get_profile_filenames_for_directory (GPtrArray *array, const gchar *di
GError *error = NULL;
gboolean ret = TRUE;
const gchar *name;
+ gchar *full_path;
/* get contents */
dir = g_dir_open (directory, 0, &error);
@@ -337,12 +338,23 @@ gcm_utils_get_profile_filenames_for_directory (GPtrArray *array, const gchar *di
name = g_dir_read_name (dir);
if (name == NULL)
break;
- if (g_str_has_suffix (name, ".icc") ||
- g_str_has_suffix (name, ".icm") ||
- g_str_has_suffix (name, ".ICC") ||
- g_str_has_suffix (name, ".ICM")) {
- g_ptr_array_add (array, g_build_filename (directory, name, NULL));
+
+ /* make the compete path */
+ full_path = g_build_filename (directory, name, NULL);
+ if (g_file_test (full_path, G_FILE_TEST_IS_DIR)) {
+ egg_debug ("recursing to %s", full_path);
+ gcm_utils_get_profile_filenames_for_directory (array, full_path);
+ } else if (g_str_has_suffix (name, ".icc") ||
+ g_str_has_suffix (name, ".icm") ||
+ g_str_has_suffix (name, ".ICC") ||
+ g_str_has_suffix (name, ".ICM")) {
+ /* add to array */
+ g_ptr_array_add (array, g_strdup (full_path));
+ } else {
+ /* invalid file */
+ egg_debug ("not recognised as ICC profile: %s", full_path);
}
+ g_free (full_path);
} while (TRUE);
out:
if (dir != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]