Delete function camel_mkdir().
authorSimon Zheng <simon.zheng@sun.com>
Tue, 10 Jan 2006 07:56:49 +0000 (07:56 +0000)
committerHarry Lu <haip@src.gnome.org>
Tue, 10 Jan 2006 07:56:49 +0000 (07:56 +0000)
2006-01-10  Simon Zheng  <simon.zheng@sun.com>

        * camel-file-utils.h:
        * camel-file-utils.c:
        Delete function camel_mkdir().

        * camel-data-cache.c: (camel_data_cache_new):
        * camel-object.c: (camel_object_state_write):
        * camel-session.c: (get_storage_path):
        * camel-uid-cache.c: (camel_uid_cache_new):
        * providers/imap/camel-imap-folder.c: (camel_imap_folder_new):
        * providers/imap4/camel-imap4-folder.c: (camel_imap4_folder_new):
        * providers/imapp/camel-imapp-folder.c: (camel_imapp_folder_new):
        * providers/local/camel-local-store.c: (get_folder):
        * providers/local/camel-mbox-store.c: (get_folder):
        (create_folder):
        (rename_folder):
        * providers/local/camel-spool-store.c: (spool_get_meta_path):
        * providers/nntp/camel-nntp-folder.c: (camel_nntp_folder_new):
        Because of deletion of camel_mkdir(), all the callers use
        e_util_mkdir_hier() instead and add the related header file
        <libedataserver/e-data-server-util.h>.

        * camel-debug.c:
        * camel-win32.c:
        As file e-util.h is renamed, replace "libedataserver/e-util.h"
        as "libedataserver/e-data-server-util.h".

16 files changed:
camel/ChangeLog
camel/camel-data-cache.c
camel/camel-debug.c
camel/camel-file-utils.c
camel/camel-file-utils.h
camel/camel-object.c
camel/camel-session.c
camel/camel-uid-cache.c
camel/camel-win32.c
camel/providers/imap/camel-imap-folder.c
camel/providers/imap4/camel-imap4-folder.c
camel/providers/imapp/camel-imapp-folder.c
camel/providers/local/camel-local-store.c
camel/providers/local/camel-mbox-store.c
camel/providers/local/camel-spool-store.c
camel/providers/nntp/camel-nntp-folder.c

index ef81ba0..da2f91c 100644 (file)
@@ -1,3 +1,31 @@
+2006-01-10  Simon Zheng  <simon.zheng@sun.com>
+
+       * camel-file-utils.h: 
+       * camel-file-utils.c:
+       Delete function camel_mkdir().
+       
+       * camel-data-cache.c: (camel_data_cache_new):
+       * camel-object.c: (camel_object_state_write):
+       * camel-session.c: (get_storage_path):
+       * camel-uid-cache.c: (camel_uid_cache_new):
+       * providers/imap/camel-imap-folder.c: (camel_imap_folder_new):
+       * providers/imap4/camel-imap4-folder.c: (camel_imap4_folder_new):
+       * providers/imapp/camel-imapp-folder.c: (camel_imapp_folder_new):
+       * providers/local/camel-local-store.c: (get_folder):
+       * providers/local/camel-mbox-store.c: (get_folder):
+       (create_folder):
+       (rename_folder):
+       * providers/local/camel-spool-store.c: (spool_get_meta_path):
+       * providers/nntp/camel-nntp-folder.c: (camel_nntp_folder_new):
+       Because of deletion of camel_mkdir(), all the callers use
+       e_util_mkdir_hier() instead and add the related header file 
+       <libedataserver/e-data-server-util.h>.
+
+       * camel-debug.c:
+       * camel-win32.c:
+       As file e-util.h is renamed, replace "libedataserver/e-util.h"
+        as "libedataserver/e-data-server-util.h".
+
 2006-01-05  Kjartan Maraas  <kmaraas@gnome.org>
 
        * camel-session.c: (camel_session_get_network_state): Return
index 6a2eff9..ee46ca9 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <glib/gstdio.h>
 
+#include <libedataserver/e-data-server-util.h>
 #include "camel-i18n.h"
 #include "camel-data-cache.h"
 #include "camel-exception.h"
@@ -130,7 +131,7 @@ camel_data_cache_new(const char *path, guint32 flags, CamelException *ex)
 {
        CamelDataCache *cdc;
 
-       if (camel_mkdir (path, 0700) == -1) {
+       if (e_util_mkdir_hier (path, 0700) == -1) {
                camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
                                     _("Unable to create cache path"));
                return NULL;
@@ -246,7 +247,7 @@ data_cache_path(CamelDataCache *cdc, int create, const char *path, const char *k
        if (access (dir, F_OK) == -1) {
 #endif
                if (create)
-                       camel_mkdir (dir, 0700);
+                       e_util_mkdir_hier (dir, 0700);
        } else if (cdc->priv->expire_inc == hash
                   && (cdc->expire_age != -1 || cdc->expire_access != -1)) {
                time_t now;
index 1ac589c..2b3c10e 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <pthread.h>
 
-#include "libedataserver/e-util.h"
+#include "libedataserver/e-data-server-util.h"
 #include "camel-debug.h"
 
 int camel_verbose_debug;
index 7533303..85a11c9 100644 (file)
@@ -41,7 +41,7 @@
 #define EWOULDBLOCK EAGAIN
 #endif
 
-#include "libedataserver/e-util.h"
+#include "libedataserver/e-data-server-util.h"
 
 #include "camel-file-utils.h"
 #include "camel-operation.h"
@@ -318,46 +318,6 @@ camel_file_util_decode_string (FILE *in, char **str)
 
 
 /**
- * camel_mkdir:
- * @path: directory path to create
- * @mode: permissions
- *
- * Creates the directory path described in @path, creating any parent
- * directories as necessary.
- *
- * Returns 0 on success or -1 on fail. In the case of failure, errno
- * will be set appropriately.
- **/
-int
-camel_mkdir (const char *path, mode_t mode)
-{
-#if GLIB_CHECK_VERSION(2,8,0)
-       g_assert(path && g_path_is_absolute (path));
-       return g_mkdir_with_parents (path, mode);
-#else
-       char *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);
-       
-       return 0;
-#endif
-}
-
-/**
  * camel_file_util_safe_filename:
  * @name: string to 'flattened' into a safe filename
  *
index 5a6d8e9..46bf6d2 100644 (file)
@@ -55,7 +55,6 @@ int camel_file_util_decode_size_t (FILE *in, size_t *);
 int camel_file_util_encode_string (FILE *out, const char *);
 int camel_file_util_decode_string (FILE *in, char **);
 
-int camel_mkdir (const char *path, mode_t mode);
 char *camel_file_util_safe_filename (const char *name);
 
 /* Code that intends to be portable to Win32 should use camel_read()
index a5593d1..36334bd 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "libedataserver/e-memory.h"
 #include "libedataserver/e-msgport.h"
+#include "libedataserver/e-data-server-util.h"
 
 #include "camel-file-utils.h"
 #include "camel-object.h"
@@ -1844,7 +1845,7 @@ int camel_object_state_write(void *vo)
 
        savename = camel_file_util_savename(file);
        dirname = g_path_get_dirname(savename);
-       camel_mkdir(dirname, 0777);
+       e_util_mkdir_hier(dirname, 0777);
        g_free(dirname);
        fp = g_fopen(savename, "wb");
        if (fp != NULL) {
index 6333b77..a9aeafd 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <glib/gstdio.h>
 
+#include "libedataserver/e-data-server-util.h"
 #include "camel-exception.h"
 #include "camel-file-utils.h"
 #include "camel-i18n.h"
@@ -286,7 +287,7 @@ get_storage_path (CamelSession *session, CamelService *service, CamelException *
 #endif
                return path;
 
-       if (camel_mkdir (path, S_IRWXU) == -1) {
+       if (e_util_mkdir_hier (path, S_IRWXU) == -1) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                      _("Could not create directory %s:\n%s"),
                                      path, g_strerror (errno));
index fa58f2b..4a3e0a4 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <glib/gstdio.h>
 
+#include "libedataserver/e-data-server-util.h"
 #include "camel-file-utils.h"
 #include "camel-private.h"
 #include "camel-uid-cache.h"
@@ -63,7 +64,7 @@ camel_uid_cache_new (const char *filename)
        int fd, i;
        
        dirname = g_path_get_dirname (filename);
-       if (camel_mkdir (dirname, 0777) == -1) {
+       if (e_util_mkdir_hier (dirname, 0777) == -1) {
                g_free (dirname);
                return NULL;
        }
index d8afc6d..df1221c 100644 (file)
@@ -31,7 +31,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include <libedataserver/e-util.h>
+#include <libedataserver/e-data-server-util.h>
 
 #include "camel.h"
 
index 36aa87f..c5b0608 100644 (file)
@@ -36,6 +36,7 @@
 
 /*#include "libedataserver/e-path.h"*/
 #include "libedataserver/e-time-utils.h"
+#include "libedataserver/e-data-server-util.h"
 
 #include "camel-imap-folder.h"
 #include "camel-imap-command.h"
@@ -227,7 +228,7 @@ camel_imap_folder_new (CamelStore *parent, const char *folder_name,
        const char *short_name;
        char *summary_file, *state_file;
 
-       if (camel_mkdir (folder_dir, S_IRWXU) != 0) {
+       if (e_util_mkdir_hier (folder_dir, S_IRWXU) != 0) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                      _("Could not create directory %s: %s"),
                                      folder_dir, g_strerror (errno));
index 86c2f93..a35865a 100644 (file)
@@ -35,6 +35,7 @@
 #include <errno.h>
 #include <time.h>
 
+#include <libedataserver/e-data-server-util.h>
 #include <camel/camel-utf8.h>
 #include <camel/camel-private.h>
 #include <camel/camel-file-utils.h>
@@ -345,7 +346,7 @@ camel_imap4_folder_new (CamelStore *store, const char *full_name, CamelException
        
        folder->summary = camel_imap4_summary_new (folder);
        imap4_folder->cachedir = imap4_store_build_filename (store, folder->full_name);
-       camel_mkdir (imap4_folder->cachedir, 0777);
+       e_util_mkdir_hier (imap4_folder->cachedir, 0777);
        
        imap4_folder->cache = camel_data_cache_new (imap4_folder->cachedir, 0, NULL);
        
index 40894a6..ccb805a 100644 (file)
@@ -42,6 +42,7 @@
 #include "camel-imapp-exception.h"
 
 #include <libedataserver/md5-utils.h>
+#include <libedataserver/e-data-server-util.h>
 
 #include <stdlib.h>
 #include <string.h>
@@ -134,7 +135,7 @@ camel_imapp_folder_new(CamelStore *store, const char *path)
                char *base = g_build_filename(root, path, NULL);
                char *file = g_build_filename(base, ".ev-summary", NULL);
 
-               camel_mkdir(base, 0777);
+               e_util_mkdir_hier(base, 0777);
                g_free(base);
 
                camel_folder_summary_set_filename(folder->summary, file);
index 42cbe11..5aa4b26 100644 (file)
@@ -32,6 +32,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
+#include <libedataserver/e-data-server-util.h>
 #include "camel/camel-exception.h"
 #include "camel/camel-file-utils.h"
 #include "camel/camel-i18n.h"
@@ -174,7 +175,7 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce
        }
        
        /* need to create the dir heirarchy */
-       if (camel_mkdir (path, 0777) == -1 && errno != EEXIST) {
+       if (e_util_mkdir_hier (path, 0777) == -1 && errno != EEXIST) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
                                      _("Cannot get folder: %s: %s"),
                                      path, g_strerror (errno));
index 7a64a14..b157f3d 100644 (file)
@@ -32,6 +32,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
+#include <libedataserver/e-data-server-util.h>
 #include "camel/camel-exception.h"
 #include "camel/camel-file-utils.h"
 #include "camel/camel-i18n.h"
@@ -168,7 +169,7 @@ get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelExcep
                g_free (basename);
                
                dirname = g_path_get_dirname(name);
-               if (camel_mkdir(dirname, 0777) == -1 && errno != EEXIST) {
+               if (e_util_mkdir_hier(dirname, 0777) == -1 && errno != EEXIST) {
                        camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
                                             _("Cannot create folder `%s': %s"),
                                             folder_name, g_strerror (errno));
@@ -359,7 +360,7 @@ create_folder(CamelStore *store, const char *parent_name, const char *folder_nam
        path = camel_local_store_get_full_path(store, name);
        
        dir = g_path_get_dirname(path);
-       if (camel_mkdir(dir, 0777) == -1 && errno != EEXIST) {
+       if (e_util_mkdir_hier(dir, 0777) == -1 && errno != EEXIST) {
                camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create directory `%s': %s."),
                                     dir, g_strerror(errno));
                
@@ -477,7 +478,7 @@ rename_folder(CamelStore *store, const char *old, const char *new, CamelExceptio
        newibex = camel_local_store_get_meta_path(store, new, ".ibex");
        
        newdir = g_path_get_dirname(newibex);
-       if (camel_mkdir(newdir, 0777) == -1) {
+       if (e_util_mkdir_hier(newdir, 0777) == -1) {
                if (errno != EEXIST) {
                        camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
                                             _("Could not rename `%s': `%s': %s"),
index 8c46065..c6d8a29 100644 (file)
@@ -36,6 +36,7 @@
 #include <stdio.h>
 #include <dirent.h>
 
+#include <libedataserver/e-data-server-util.h>
 #include "camel-spool-store.h"
 #include "camel-spool-folder.h"
 #include "camel-exception.h"
@@ -492,7 +493,7 @@ spool_get_meta_path(CamelLocalStore *ls, const char *full_name, const char *ext)
        if (root == NULL)
                return NULL;
 
-       camel_mkdir(root, 0777);
+       e_util_mkdir_hier(root, 0777);
        key = camel_file_util_safe_filename(full_name);
        path = g_strdup_printf("%s/%s%s", root, key, ext);
        g_free(key);
index 7df6569..4c8861e 100644 (file)
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include <libedataserver/e-data-server-util.h>
 #include "camel/camel-file-utils.h"
 #include "camel/camel-stream-mem.h"
 #include "camel/camel-data-wrapper.h"
@@ -491,7 +492,7 @@ camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelExcepti
                return NULL;
        
        /* If this doesn't work, stuff wont save, but let it continue anyway */
-       camel_mkdir (root, 0777);
+       e_util_mkdir_hier (root, 0777);
        
        folder = (CamelFolder *) camel_object_new (CAMEL_NNTP_FOLDER_TYPE);
        nntp_folder = (CamelNNTPFolder *)folder;