diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-07-08 04:58:24 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-07-08 04:58:24 +0800 |
commit | 300101f4707c7c0a0e29d24527a93afe0f77a2c7 (patch) | |
tree | aac6a6bde47fb918f72abdac77d6e33f3759a6c4 | |
parent | 393aafe6b21dfc482b41a08297292ff0e8b05037 (diff) | |
download | gsoc2013-evolution-300101f4707c7c0a0e29d24527a93afe0f77a2c7.tar.gz gsoc2013-evolution-300101f4707c7c0a0e29d24527a93afe0f77a2c7.tar.zst gsoc2013-evolution-300101f4707c7c0a0e29d24527a93afe0f77a2c7.zip |
Use camel_mkdir().
2003-07-07 Jeffrey Stedfast <fejj@ximian.com>
* providers/nntp/camel-nntp-folder.c (camel_nntp_folder_new): Use
camel_mkdir().
* providers/imap/camel-imap-folder.c (camel_imap_folder_new): Use
camel_mkdir().
* camel-session.c (get_storage_path): Use camel_mkdir().
* camel-store.c (camel_mkdir_hier): Removed.
* camel-data-cache.c (camel_data_cache_new): Updated to use
camel_mkdir().
(data_cache_path): Same.
* camel-file-utils.c (camel_mkdir): Renamed and documented.
(camel_file_util_safe_filename): Documented.
(camel_read): Moved here from camel-io.c
(camel_write): Same.
* camel-io.[c,h]: Removed.
* camel-uid-cache.c (camel_uid_cache_new): Use the
camel-file-utils.c version of mkdir.
svn path=/trunk/; revision=21753
-rw-r--r-- | camel/ChangeLog | 26 | ||||
-rw-r--r-- | camel/Makefile.am | 2 | ||||
-rw-r--r-- | camel/camel-data-cache.c | 4 | ||||
-rw-r--r-- | camel/camel-file-utils.c | 220 | ||||
-rw-r--r-- | camel/camel-file-utils.h | 12 | ||||
-rw-r--r-- | camel/camel-io.c | 170 | ||||
-rw-r--r-- | camel/camel-io.h | 42 | ||||
-rw-r--r-- | camel/camel-session.c | 3 | ||||
-rw-r--r-- | camel/camel-store.c | 25 | ||||
-rw-r--r-- | camel/camel-store.h | 9 | ||||
-rw-r--r-- | camel/camel-uid-cache.c | 5 | ||||
-rw-r--r-- | camel/camel.h | 2 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 3 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 2 | ||||
-rw-r--r-- | camel/providers/nntp/camel-nntp-folder.c | 4 |
15 files changed, 252 insertions, 277 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 5e8962bc1f..36cc6a5272 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,31 @@ 2003-07-07 Jeffrey Stedfast <fejj@ximian.com> + * providers/nntp/camel-nntp-folder.c (camel_nntp_folder_new): Use + camel_mkdir(). + + * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Use + camel_mkdir(). + + * camel-session.c (get_storage_path): Use camel_mkdir(). + + * camel-store.c (camel_mkdir_hier): Removed. + + * camel-data-cache.c (camel_data_cache_new): Updated to use + camel_mkdir(). + (data_cache_path): Same. + + * camel-file-utils.c (camel_mkdir): Renamed and documented. + (camel_file_util_safe_filename): Documented. + (camel_read): Moved here from camel-io.c + (camel_write): Same. + + * camel-io.[c,h]: Removed. + + * camel-uid-cache.c (camel_uid_cache_new): Use the + camel-file-utils.c version of mkdir. + +2003-07-07 Jeffrey Stedfast <fejj@ximian.com> + * camel-session.c (camel_session_init): Updated for string-utils namespace changes. diff --git a/camel/Makefile.am b/camel/Makefile.am index 8baa5d322d..ae53085715 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -49,7 +49,6 @@ libcamel_la_SOURCES = \ camel-http-stream.c \ camel-index.c \ camel-internet-address.c \ - camel-io.c \ camel-lock.c \ camel-lock-client.c \ camel-medium.c \ @@ -151,7 +150,6 @@ libcamelinclude_HEADERS = \ camel-http-stream.h \ camel-index.h \ camel-internet-address.h \ - camel-io.h \ camel-i18n.h \ camel-lock.h \ camel-lock-client.h \ diff --git a/camel/camel-data-cache.c b/camel/camel-data-cache.c index b5e615a112..a585f59a9d 100644 --- a/camel/camel-data-cache.c +++ b/camel/camel-data-cache.c @@ -128,7 +128,7 @@ camel_data_cache_new(const char *path, guint32 flags, CamelException *ex) { CamelDataCache *cdc; - if (camel_file_util_mkdir(path, 0700) == -1) { + if (camel_mkdir (path, 0700) == -1) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Unable to create cache path")); return NULL; @@ -239,7 +239,7 @@ data_cache_path(CamelDataCache *cdc, int create, const char *path, const char *k sprintf(dir, "%s/%s/%02x", cdc->path, path, hash); if (access(dir, F_OK) == -1) { if (create) - camel_file_util_mkdir(dir, 0700); + camel_mkdir (dir, 0700); } else if (cdc->priv->expire_inc == hash && (cdc->expire_age != -1 || cdc->expire_access != -1)) { time_t now; diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c index f0e400ebac..c6e2a0fea2 100644 --- a/camel/camel-file-utils.c +++ b/camel/camel-file-utils.c @@ -2,9 +2,10 @@ * * Authors: * Michael Zucchi <notzed@ximian.com> + * Jeffrey Stedfast <fejj@ximian.com> * Dan Winship <danw@ximian.com> * - * Copyright (C) 2000, 2001 Ximian, Inc. + * Copyright (C) 2000, 2003 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -26,22 +27,23 @@ #include <config.h> #endif -#include "camel-file-utils.h" -#include "camel-url.h" - +#include <string.h> #include <sys/stat.h> #include <sys/types.h> -#include <fcntl.h> +#include <netinet/in.h> #include <unistd.h> +#include <fcntl.h> +#include <errno.h> -#include <string.h> - -#include <netinet/in.h> +#include "camel-file-utils.h" +#include "camel-operation.h" +#include "camel-url.h" -#ifdef HAVE_ALLOCA_H -#include <alloca.h> +#ifndef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif + /** * camel_file_util_encode_uint32: * @out: file to output to @@ -66,6 +68,7 @@ camel_file_util_encode_uint32 (FILE *out, guint32 value) return fputc (value | 0x80, out); } + /** * camel_file_util_decode_uint32: * @in: file to read from @@ -96,6 +99,7 @@ camel_file_util_decode_uint32 (FILE *in, guint32 *dest) return 0; } + /** * camel_file_util_encode_fixed_int32: * @out: file to output to @@ -117,6 +121,7 @@ camel_file_util_encode_fixed_int32 (FILE *out, gint32 value) return 0; } + /** * camel_file_util_decode_fixed_int32: * @in: file to read from @@ -139,6 +144,7 @@ camel_file_util_decode_fixed_int32 (FILE *in, gint32 *dest) } } + /** * camel_file_util_encode_time_t: * @out: file to output to @@ -160,6 +166,7 @@ camel_file_util_encode_time_t(FILE *out, time_t value) return 0; } + /** * camel_file_util_decode_time_t: * @in: file to read from @@ -186,6 +193,7 @@ camel_file_util_decode_time_t (FILE *in, time_t *dest) return 0; } + /** * camel_file_util_encode_off_t: * @out: file to output to @@ -207,6 +215,7 @@ camel_file_util_encode_off_t (FILE *out, off_t value) return 0; } + /** * camel_file_util_decode_off_t: * @in: file to read from @@ -233,6 +242,7 @@ camel_file_util_decode_off_t (FILE *in, off_t *dest) return 0; } + /** * camel_file_util_encode_string: * @out: file to output to @@ -258,6 +268,7 @@ camel_file_util_encode_string (FILE *out, const char *str) return -1; } + /** * camel_file_util_decode_string: * @in: file to read from @@ -296,16 +307,26 @@ camel_file_util_decode_string (FILE *in, char **str) return 0; } -/* Make a directory heirarchy. - Always use full paths */ + +/** + * 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_file_util_mkdir(const char *path, mode_t mode) +camel_mkdir (const char *path, mode_t mode) { char *copy, *p; - + g_assert(path && path[0] == '/'); - - p = copy = alloca(strlen(path)+1); + + p = copy = g_alloca (strlen (path) + 1); strcpy(copy, path); do { p = strchr(p + 1, '/'); @@ -318,15 +339,178 @@ camel_file_util_mkdir(const char *path, mode_t mode) if (p) *p = '/'; } while (p); - + return 0; } + +/** + * camel_file_util_safe_filename: + * @name: string to 'flattened' into a safe filename + * + * 'Flattens' @name into a safe filename string by hex encoding any + * chars that may cause problems on the filesystem. + * + * Returns a safe filename string. + **/ char * -camel_file_util_safe_filename(const char *name) +camel_file_util_safe_filename (const char *name) { if (name == NULL) return NULL; return camel_url_encode(name, "/?()'*"); } + + +/* FIXME: poll() might be more efficient and more portable? */ + +/** + * camel_read: + * @fd: file descriptor + * @buf: buffer to fill + * @n: number of bytes to read into @buf + * + * Cancellable libc read() replacement. + * + * Returns number of bytes read or -1 on fail. On failure, errno will + * be set appropriately. + **/ +ssize_t +camel_read (int fd, char *buf, size_t n) +{ + ssize_t nread; + int cancel_fd; + + if (camel_operation_cancel_check (NULL)) { + errno = EINTR; + return -1; + } + + cancel_fd = camel_operation_cancel_fd (NULL); + if (cancel_fd == -1) { + do { + nread = read (fd, buf, n); + } while (nread == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)); + } else { + int errnosav, flags, fdmax; + fd_set rdset; + + flags = fcntl (fd, F_GETFL); + fcntl (fd, F_SETFL, flags | O_NONBLOCK); + + do { + FD_ZERO (&rdset); + FD_SET (fd, &rdset); + FD_SET (cancel_fd, &rdset); + fdmax = MAX (fd, cancel_fd) + 1; + + nread = -1; + if (select (fdmax, &rdset, 0, 0, NULL) != -1) { + if (FD_ISSET (cancel_fd, &rdset)) { + fcntl (fd, F_SETFL, flags); + errno = EINTR; + return -1; + } + + do { + nread = read (fd, buf, n); + } while (nread == -1 && errno == EINTR); + } else if (errno == EINTR) { + errno = EAGAIN; + } + } while (nread == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)); + + errnosav = errno; + fcntl (fd, F_SETFL, flags); + errno = errnosav; + } + + return nread; +} + + +/** + * camel_write: + * @fd: file descriptor + * @buf: buffer to write + * @n: number of bytes of @buf to write + * + * Cancellable libc write() replacement. + * + * Returns number of bytes written or -1 on fail. On failure, errno will + * be set appropriately. + **/ +ssize_t +camel_write (int fd, const char *buf, size_t n) +{ + ssize_t w, written = 0; + int cancel_fd; + + if (camel_operation_cancel_check (NULL)) { + errno = EINTR; + return -1; + } + + cancel_fd = camel_operation_cancel_fd (NULL); + if (cancel_fd == -1) { + do { + do { + w = write (fd, buf + written, n - written); + } while (w == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)); + + if (w > 0) + written += w; + } while (w != -1 && written < n); + } else { + int errnosav, flags, fdmax; + fd_set rdset, wrset; + + flags = fcntl (fd, F_GETFL); + fcntl (fd, F_SETFL, flags | O_NONBLOCK); + + fdmax = MAX (fd, cancel_fd) + 1; + do { + FD_ZERO (&rdset); + FD_ZERO (&wrset); + FD_SET (fd, &wrset); + FD_SET (cancel_fd, &rdset); + + w = -1; + if (select (fdmax, &rdset, &wrset, 0, NULL) != -1) { + if (FD_ISSET (cancel_fd, &rdset)) { + fcntl (fd, F_SETFL, flags); + errno = EINTR; + return -1; + } + + do { + w = write (fd, buf + written, n - written); + } while (w == -1 && errno == EINTR); + + if (w == -1) { + if (errno == EAGAIN || errno == EWOULDBLOCK) { + w = 0; + } else { + errnosav = errno; + fcntl (fd, F_SETFL, flags); + errno = errnosav; + return -1; + } + } else + written += w; + } else if (errno == EINTR) { + w = 0; + } + } while (w != -1 && written < n); + + errnosav = errno; + fcntl (fd, F_SETFL, flags); + errno = errnosav; + } + + if (w == -1) + return -1; + + return written; +} diff --git a/camel/camel-file-utils.h b/camel/camel-file-utils.h index e261ead16b..f1c3079b67 100644 --- a/camel/camel-file-utils.h +++ b/camel/camel-file-utils.h @@ -3,9 +3,10 @@ /* * Authors: * Michael Zucchi <notzed@ximian.com> + * Jeffrey Stedfast <fejj@ximian.com> * Dan Winship <danw@ximian.com> * - * Copyright (C) 2000, 2001 Ximian, Inc. + * Copyright (C) 2000, 2003 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -29,7 +30,7 @@ #ifdef __cplusplus extern "C" { #pragma } -#endif /* __cplusplus }*/ +#endif /* __cplusplus */ #include <glib.h> #include <stdio.h> @@ -47,8 +48,11 @@ int camel_file_util_decode_off_t (FILE *in, off_t *); int camel_file_util_encode_string (FILE *out, const char *); int camel_file_util_decode_string (FILE *in, char **); -int camel_file_util_mkdir(const char *path, mode_t mode); -char *camel_file_util_safe_filename(const char *name); +int camel_mkdir (const char *path, mode_t mode); +char *camel_file_util_safe_filename (const char *name); + +ssize_t camel_read (int fd, char *buf, size_t n); +ssize_t camel_write (int fd, const char *buf, size_t n); #ifdef __cplusplus } diff --git a/camel/camel-io.c b/camel/camel-io.c deleted file mode 100644 index df831162ba..0000000000 --- a/camel/camel-io.c +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2003 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <sys/time.h> -#include <sys/types.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> - -#include "camel-io.h" -#include "camel-operation.h" - - -#ifndef MAX -#define MAX(a,b) ((a) > (b) ? (a) : (b)) -#endif - -/* FIXME: should we trade out select() for a poll() instead? */ - -ssize_t -camel_read (int fd, char *buf, size_t n) -{ - ssize_t nread; - int cancel_fd; - - if (camel_operation_cancel_check (NULL)) { - errno = EINTR; - return -1; - } - - cancel_fd = camel_operation_cancel_fd (NULL); - if (cancel_fd == -1) { - do { - nread = read (fd, buf, n); - } while (nread == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)); - } else { - int errnosav, flags, fdmax; - fd_set rdset; - - flags = fcntl (fd, F_GETFL); - fcntl (fd, F_SETFL, flags | O_NONBLOCK); - - do { - FD_ZERO (&rdset); - FD_SET (fd, &rdset); - FD_SET (cancel_fd, &rdset); - fdmax = MAX (fd, cancel_fd) + 1; - - nread = -1; - if (select (fdmax, &rdset, 0, 0, NULL) != -1) { - if (FD_ISSET (cancel_fd, &rdset)) { - fcntl (fd, F_SETFL, flags); - errno = EINTR; - return -1; - } - - do { - nread = read (fd, buf, n); - } while (nread == -1 && errno == EINTR); - } else if (errno == EINTR) { - errno = EAGAIN; - } - } while (nread == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)); - - errnosav = errno; - fcntl (fd, F_SETFL, flags); - errno = errnosav; - } - - return nread; -} - - -ssize_t -camel_write (int fd, const char *buf, size_t n) -{ - ssize_t w, written = 0; - int cancel_fd; - - if (camel_operation_cancel_check (NULL)) { - errno = EINTR; - return -1; - } - - cancel_fd = camel_operation_cancel_fd (NULL); - if (cancel_fd == -1) { - do { - do { - w = write (fd, buf + written, n - written); - } while (w == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)); - - if (w > 0) - written += w; - } while (w != -1 && written < n); - } else { - int errnosav, flags, fdmax; - fd_set rdset, wrset; - - flags = fcntl (fd, F_GETFL); - fcntl (fd, F_SETFL, flags | O_NONBLOCK); - - fdmax = MAX (fd, cancel_fd) + 1; - do { - FD_ZERO (&rdset); - FD_ZERO (&wrset); - FD_SET (fd, &wrset); - FD_SET (cancel_fd, &rdset); - - w = -1; - if (select (fdmax, &rdset, &wrset, 0, NULL) != -1) { - if (FD_ISSET (cancel_fd, &rdset)) { - fcntl (fd, F_SETFL, flags); - errno = EINTR; - return -1; - } - - do { - w = write (fd, buf + written, n - written); - } while (w == -1 && errno == EINTR); - - if (w == -1) { - if (errno == EAGAIN || errno == EWOULDBLOCK) { - w = 0; - } else { - errnosav = errno; - fcntl (fd, F_SETFL, flags); - errno = errnosav; - return -1; - } - } else - written += w; - } else if (errno == EINTR) { - w = 0; - } - } while (w != -1 && written < n); - - errnosav = errno; - fcntl (fd, F_SETFL, flags); - errno = errnosav; - } - - if (w == -1) - return -1; - - return written; -} diff --git a/camel/camel-io.h b/camel/camel-io.h deleted file mode 100644 index a4e47c018f..0000000000 --- a/camel/camel-io.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2003 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifndef __CAMEL_IO_H__ -#define __CAMEL_IO_H__ - -#include <sys/types.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -ssize_t camel_read (int fd, char *buf, size_t n); - -ssize_t camel_write (int fd, const char *buf, size_t n); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __CAMEL_IO_H__ */ diff --git a/camel/camel-session.c b/camel/camel-session.c index 1f1c7ce259..764cb30a6a 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -38,6 +38,7 @@ #include "camel-store.h" #include "camel-transport.h" #include "camel-exception.h" +#include "camel-file-utils.h" #include "camel-string-utils.h" #include "camel-url.h" #include "camel-vee-store.h" @@ -523,7 +524,7 @@ get_storage_path (CamelSession *session, CamelService *service, CamelException * if (access (path, F_OK) == 0) return path; - if (camel_mkdir_hier (path, S_IRWXU) == -1) { + if (camel_mkdir (path, S_IRWXU) == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create directory %s:\n%s"), path, g_strerror (errno)); diff --git a/camel/camel-store.c b/camel/camel-store.c index 2756fbc483..0bc80b43de 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -1052,31 +1052,6 @@ camel_store_noop (CamelStore *store, CamelException *ex) } -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; -} - - /* Return true if these uri's refer to the same object */ gboolean camel_store_uri_cmp(CamelStore *store, const char *uria, const char *urib) diff --git a/camel/camel-store.h b/camel/camel-store.h index 34627918e2..4a0fb416f0 100644 --- a/camel/camel-store.h +++ b/camel/camel-store.h @@ -4,8 +4,10 @@ /* * * Authors: Bertrand Guiheneuf <bertrand@helixcode.com> + * Michael Zucchi <NotZed@ximian.com> + * Jeffrey Stedfast <fejj@ximian.com> * - * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com) + * Copyright 1999, 2003 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -30,7 +32,7 @@ #ifdef __cplusplus extern "C" { #pragma } -#endif /* __cplusplus }*/ +#endif /* __cplusplus */ /* for mode_t */ #include <sys/types.h> @@ -226,9 +228,6 @@ void camel_store_noop (CamelStore *store, gboolean camel_store_uri_cmp (CamelStore *store, const char *uria, const char *urib); -/* utility needed by some stores */ -int camel_mkdir_hier (const char *path, mode_t mode); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/camel/camel-uid-cache.c b/camel/camel-uid-cache.c index 5bb616b304..c31c2761b2 100644 --- a/camel/camel-uid-cache.c +++ b/camel/camel-uid-cache.c @@ -32,9 +32,8 @@ #include <sys/stat.h> #include <unistd.h> -#include "camel-io.h" -#include "camel-store.h" /* for camel_mkdir_hier */ #include "camel-uid-cache.h" +#include "camel-file-utils.h" struct _uid_state { int level; @@ -61,7 +60,7 @@ camel_uid_cache_new (const char *filename) int fd, i; dirname = g_path_get_dirname (filename); - if (camel_mkdir_hier (dirname, 0777) == -1) { + if (camel_mkdir (dirname, 0777) == -1) { g_free (dirname); return NULL; } diff --git a/camel/camel.h b/camel/camel.h index 014e79fafd..8754abd1d1 100644 --- a/camel/camel.h +++ b/camel/camel.h @@ -84,7 +84,7 @@ extern "C" { #include <camel/camel-transport.h> #include <camel/camel-uid-cache.h> #include <camel/camel-url.h> -#include <camel/string-utils.h> +#include <camel/camel-string-utils.h> gint camel_init (const char *certdb_dir, gboolean nss_init); diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 860ce7026f..07c2a3cf57 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -68,6 +68,7 @@ #include "camel-stream.h" #include "camel-private.h" #include "camel-string-utils.h" +#include "camel-file-utils.h" #define d(x) @@ -217,7 +218,7 @@ camel_imap_folder_new (CamelStore *parent, const char *folder_name, const char *short_name; char *summary_file; - if (camel_mkdir_hier (folder_dir, S_IRWXU) != 0) { + if (camel_mkdir (folder_dir, S_IRWXU) != 0) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create directory %s: %s"), folder_dir, g_strerror (errno)); diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 5e63a11cad..bd1daaf0a2 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -6,7 +6,7 @@ * Dan Winship <danw@ximian.com> * Jeffrey Stedfast <fejj@ximian.com> * - * Copyright 2000, 2001 Ximian, Inc. + * Copyright 2000, 2003 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index cfe1466561..6603895596 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -33,7 +33,7 @@ #include <string.h> #include <fcntl.h> -#include "camel/string-utils.h" +#include "camel/camel-file-utils.h" #include "camel/camel-stream-mem.h" #include "camel/camel-data-wrapper.h" #include "camel/camel-mime-message.h" @@ -377,7 +377,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 */ - (void) camel_mkdir_hier(root, 0777); + camel_mkdir (root, 0777); folder = (CamelFolder *) camel_object_new (CAMEL_NNTP_FOLDER_TYPE); nntp_folder = (CamelNNTPFolder *)folder; |