[tepl] MetadataStore: use tepl_utils_create_parent_directories()



commit 47738e978e27610d32fea53dd05de700b5423b8d
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Mar 31 11:16:35 2020 +0200

    MetadataStore: use tepl_utils_create_parent_directories()

 tepl/tepl-metadata-store.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)
---
diff --git a/tepl/tepl-metadata-store.c b/tepl/tepl-metadata-store.c
index 0a78fc1..2e340c7 100644
--- a/tepl/tepl-metadata-store.c
+++ b/tepl/tepl-metadata-store.c
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "tepl-metadata-store.h"
 #include <glib/gi18n-lib.h>
+#include "tepl-utils.h"
 
 /**
  * SECTION:metadata-store
@@ -992,25 +993,9 @@ tepl_metadata_store_save (TeplMetadataStore  *store,
                return TRUE;
        }
 
-       if (g_file_has_parent (store->priv->xml_file, NULL))
+       if (!tepl_utils_create_parent_directories (store->priv->xml_file, cancellable, error))
        {
-               GFile *parent_dir;
-               GError *my_error = NULL;
-
-               parent_dir = g_file_get_parent (store->priv->xml_file);
-               g_file_make_directory_with_parents (parent_dir, cancellable, &my_error);
-               g_object_unref (parent_dir);
-
-               if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
-               {
-                       g_clear_error (&my_error);
-               }
-               if (my_error != NULL)
-               {
-                       g_propagate_error (error, my_error);
-                       return FALSE;
-               }
-
+               return FALSE;
        }
 
        resize_hash_table_according_to_max_number_of_locations (store);


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