aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-store.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r--camel/camel-store.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c
index e01509e029..3314b710d8 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -777,3 +777,28 @@ camel_store_unsubscribe_folder (CamelStore *store,
CAMEL_STORE_UNLOCK(store, folder_lock);
}
+
+
+int
+camel_mkdir_hier (const char *path, mode_t mode)
+{
+ char *copy, *p;
+
+ p = copy = g_strdup (path);
+ do {
+ p = strchr (p + 1, '/');
+ if (p)
+ *p = '\0';
+ if (access (copy, F_OK) == -1) {
+ if (mkdir (copy, mode) == -1) {
+ g_free (copy);
+ return -1;
+ }
+ }
+ if (p)
+ *p = '/';
+ } while (p);
+
+ g_free (copy);
+ return 0;
+}