[evolution-data-server] Use g_mkdir_with_parents() in camel_mkdir()



commit 93eb443639d377d1ddc2aab32ab35a8a9a09d7d0
Author: Tor Lillqvist <tml iki fi>
Date:   Thu Nov 5 21:31:59 2009 +0200

    Use g_mkdir_with_parents() in camel_mkdir()

 camel/camel-file-utils.c |   21 +++------------------
 1 files changed, 3 insertions(+), 18 deletions(-)
---
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index 2fb6986..e0b6097 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -767,23 +767,8 @@ camel_file_util_savename(const gchar *filename)
 gint
 camel_mkdir (const gchar *path, mode_t mode)
 {
-	gchar *copy, *p;
-
-	g_assert(path && path[0] == '/');
-
-	p = copy = g_alloca (strlen (path) + 1);
-	strcpy(copy, path);
-	do {
-		p = strchr(p + 1, '/');
-		if (p)
-			*p = '\0';
-		if (access(copy, F_OK) == -1) {
-			if (mkdir(copy, mode) == -1)
-				return -1;
-		}
-		if (p)
-			*p = '/';
-	} while (p);
+	g_assert(path);
+	g_assert (g_path_is_absolute (path[0]));
 
-	return 0;
+	return g_mkdir_with_parents (path, mode);
 }



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