From 020a8e0361c3641322a62b03912d8e29a06791ba Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 23 Sep 2003 21:03:19 +0000 Subject: If the CREATE flag is set and the parent .sbd directory does not exist, 2003-09-23 Jeffrey Stedfast * providers/local/camel-mbox-store.c (get_folder): If the CREATE flag is set and the parent .sbd directory does not exist, create it. svn path=/trunk/; revision=22677 --- camel/providers/local/camel-mbox-store.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'camel/providers') diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c index 0363047c6f..b0de165656 100644 --- a/camel/providers/local/camel-mbox-store.c +++ b/camel/providers/local/camel-mbox-store.c @@ -141,6 +141,7 @@ get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelExce name = mbox_folder_name_to_path (store, folder_name); if (stat (name, &st) == -1) { + char *dirname; int fd; if (errno != ENOENT) { @@ -159,6 +160,18 @@ get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelExce return NULL; } + dirname = g_path_get_dirname (name); + if (camel_mkdir (dirname, 0777) == -1 && errno != EEXIST) { + camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Could not create directory `%s':\n%s"), + dirname, g_strerror (errno)); + g_free (dirname); + g_free (name); + return NULL; + } + + g_free (dirname); + fd = open (name, O_WRONLY | O_CREAT | O_APPEND, 0666); if (fd == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, -- cgit v1.2.3