[evolution] [ECompEditor] Ensure local store directory exists before saving attachments



commit d1c857d998bfddd2c0d00a17b0c82fdb5a2708d0
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 19 08:00:49 2017 +0200

    [ECompEditor] Ensure local store directory exists before saving attachments

 src/calendar/gui/e-comp-editor.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor.c b/src/calendar/gui/e-comp-editor.c
index baf479d..7fa78c2 100644
--- a/src/calendar/gui/e-comp-editor.c
+++ b/src/calendar/gui/e-comp-editor.c
@@ -630,6 +630,7 @@ ece_save_component_attachments_sync (ECalClient *cal_client,
                                     GError **error)
 {
        icalproperty *prop;
+       const gchar *local_store;
        gchar *target_filename_prefix, *filename_prefix, *tmp;
        gboolean success = TRUE;
 
@@ -641,9 +642,13 @@ ece_save_component_attachments_sync (ECalClient *cal_client,
        filename_prefix = g_strconcat (tmp, "-", NULL);
        g_free (tmp);
 
-       target_filename_prefix = g_build_filename (
-               e_cal_client_get_local_attachment_store (cal_client),
-               filename_prefix, NULL);
+       local_store = e_cal_client_get_local_attachment_store (cal_client);
+       if (local_store && *local_store &&
+           g_mkdir_with_parents (local_store, 0700) < 0) {
+               g_debug ("%s: Failed to create local store directory '%s'", G_STRFUNC, local_store);
+       }
+
+       target_filename_prefix = g_build_filename (local_store, filename_prefix, NULL);
 
        g_free (filename_prefix);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]