[evolution/gnome-3-22] Ensure mail_session_get_cache/config/data_dir() return existing directories



commit fd3cae63ed2405b0f0489e3b45bf9ac50bb7f596
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 28 11:26:17 2016 +0100

    Ensure mail_session_get_cache/config/data_dir() return existing directories
    
    The shell_backend_get_config/data_dir() do it too, but the EMailBackend
    overrides these methods and the special implementations do not do it,
    thus when the evolution is run on a new account, then its console is
    full of related runtime warnings from EMailRemoteContent and EMailProperties.

 libemail-engine/e-mail-session.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index 23f1ad8..3030dc1 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -2264,9 +2264,10 @@ mail_session_flush_filter_log (EMailSession *session)
 const gchar *
 mail_session_get_data_dir (void)
 {
-       if (G_UNLIKELY (mail_data_dir == NULL))
-               mail_data_dir = g_build_filename (
-                       e_get_user_data_dir (), "mail", NULL);
+       if (G_UNLIKELY (mail_data_dir == NULL)) {
+               mail_data_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
+               g_mkdir_with_parents (mail_data_dir, 0700);
+       }
 
        return mail_data_dir;
 }
@@ -2274,9 +2275,10 @@ mail_session_get_data_dir (void)
 const gchar *
 mail_session_get_cache_dir (void)
 {
-       if (G_UNLIKELY (mail_cache_dir == NULL))
-               mail_cache_dir = g_build_filename (
-                       e_get_user_cache_dir (), "mail", NULL);
+       if (G_UNLIKELY (mail_cache_dir == NULL)) {
+               mail_cache_dir = g_build_filename (e_get_user_cache_dir (), "mail", NULL);
+               g_mkdir_with_parents (mail_cache_dir, 0700);
+       }
 
        return mail_cache_dir;
 }
@@ -2284,9 +2286,10 @@ mail_session_get_cache_dir (void)
 const gchar *
 mail_session_get_config_dir (void)
 {
-       if (G_UNLIKELY (mail_config_dir == NULL))
-               mail_config_dir = g_build_filename (
-                       e_get_user_config_dir (), "mail", NULL);
+       if (G_UNLIKELY (mail_config_dir == NULL)) {
+               mail_config_dir = g_build_filename (e_get_user_config_dir (), "mail", NULL);
+               g_mkdir_with_parents (mail_config_dir, 0700);
+       }
 
        return mail_config_dir;
 }


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