[evolution-data-server] Add more debug messages to basedir migration.



commit 152f8969a185478a71f7f23456817720e265f629
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Jul 28 12:54:27 2010 -0400

    Add more debug messages to basedir migration.
    
    If directory removal fails because the directory is not empty,
    list the file names in that directory.

 addressbook/libedata-book/e-data-book-migrate.c |   19 ++++++++++++++++++-
 calendar/libedata-cal/e-data-cal-migrate.c      |   19 ++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book-migrate.c b/addressbook/libedata-book/e-data-book-migrate.c
index 3b006a0..5c295eb 100644
--- a/addressbook/libedata-book/e-data-book-migrate.c
+++ b/addressbook/libedata-book/e-data-book-migrate.c
@@ -42,16 +42,33 @@ data_book_migrate_rename (const gchar *old_filename,
 static gboolean
 data_book_migrate_rmdir (const gchar *dirname)
 {
+	GDir *dir = NULL;
 	gboolean success = TRUE;
 
 	if (g_file_test (dirname, G_FILE_TEST_IS_DIR)) {
 		g_print ("  rmdir %s\n", dirname);
 		if (g_rmdir (dirname) < 0) {
-			g_printerr ("  FAILED: %s\n", g_strerror (errno));
+			g_printerr ("  FAILED: %s", g_strerror (errno));
+			if (errno == ENOTEMPTY) {
+				dir = g_dir_open (dirname, 0, NULL);
+				g_printerr (" (contents follows)");
+			}
+			g_printerr ("\n");
 			success = FALSE;
 		}
 	}
 
+	/* List the directory's contents to aid debugging. */
+	if (dir != NULL) {
+		const gchar *basename;
+
+		/* Align the filenames beneath the error message. */
+		while ((basename = g_dir_read_name (dir)) != NULL)
+			g_print ("          %s\n", basename);
+
+		g_dir_close (dir);
+	}
+
 	return success;
 }
 
diff --git a/calendar/libedata-cal/e-data-cal-migrate.c b/calendar/libedata-cal/e-data-cal-migrate.c
index 5fce9ee..4d0229d 100644
--- a/calendar/libedata-cal/e-data-cal-migrate.c
+++ b/calendar/libedata-cal/e-data-cal-migrate.c
@@ -42,16 +42,33 @@ data_cal_migrate_rename (const gchar *old_filename,
 static gboolean
 data_cal_migrate_rmdir (const gchar *dirname)
 {
+	GDir *dir = NULL;
 	gboolean success = TRUE;
 
 	if (g_file_test (dirname, G_FILE_TEST_IS_DIR)) {
 		g_print ("  rmdir %s\n", dirname);
 		if (g_rmdir (dirname) < 0) {
-			g_printerr ("  FAILED: %s\n", g_strerror (errno));
+			g_printerr ("  FAILED: %s", g_strerror (errno));
+			if (errno == ENOTEMPTY) {
+				dir = g_dir_open (dirname, 0, NULL);
+				g_printerr (" (contents follows)");
+			}
+			g_printerr ("\n");
 			success = FALSE;
 		}
 	}
 
+	/* List the directory's contents to aid debugging. */
+	if (dir != NULL) {
+		const gchar *basename;
+
+		/* Align the filenames beneath the error message. */
+		while ((basename = g_dir_read_name (dir)) != NULL)
+			g_print ("          %s\n", basename);
+
+		g_dir_close (dir);
+	}
+
 	return success;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]