[evolution-data-server] Build path portably in session_get_storage_path().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Build path portably in session_get_storage_path().
- Date: Thu, 29 Jul 2010 21:27:43 +0000 (UTC)
commit 177897bf8f588935f79c2618f3539a4b6b7f17b9
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jul 29 17:13:42 2010 -0400
Build path portably in session_get_storage_path().
camel/camel-session.c | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/camel/camel-session.c b/camel/camel-session.c
index e51c72d..dbce9a9 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -243,30 +243,28 @@ session_get_storage_path (CamelSession *session,
CamelService *service,
GError **error)
{
- gchar *path, *p;
+ gchar *service_path;
+ gchar *storage_path;
- p = camel_service_get_path (service);
- path = g_strdup_printf ("%s/%s", session->storage_path, p);
- g_free (p);
+ service_path = camel_service_get_path (service);
+ storage_path = g_build_filename (
+ session->storage_path, service_path, NULL);
+ g_free (service_path);
-#ifdef G_OS_WIN32
- if (g_access (path, F_OK) == 0)
-#else
- if (access (path, F_OK) == 0)
-#endif
- return path;
+ if (g_access (storage_path, F_OK) == 0)
+ return storage_path;
- if (g_mkdir_with_parents (path, S_IRWXU) == -1) {
+ if (g_mkdir_with_parents (storage_path, S_IRWXU) == -1) {
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
_("Could not create directory %s:\n%s"),
- path, g_strerror (errno));
- g_free (path);
- return NULL;
+ storage_path, g_strerror (errno));
+ g_free (storage_path);
+ storage_path = NULL;
}
- return path;
+ return storage_path;
}
static gpointer
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]