[gnome-software] lib: Unconditionally create the parent dirs in gs_plugin_download_file()



commit fc39bc2b405d3933d5d39597fd456d2624741b6e
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jul 26 13:03:06 2017 +0100

    lib: Unconditionally create the parent dirs in gs_plugin_download_file()
    
    The fedora-pkgdb-collections plugin was forgetting to do this, leading to an
    in-app notification if the user ever cleared the cachedir manually.

 lib/gs-plugin.c                 |    2 ++
 plugins/steam/gs-plugin-steam.c |    2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/gs-plugin.c b/lib/gs-plugin.c
index 8a823e5..8fcf031 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -1371,6 +1371,8 @@ gs_plugin_download_file (GsPlugin *plugin,
                             uri, str->str);
                return FALSE;
        }
+       if (!gs_mkdir_parent (filename, error))
+               return FALSE;
        if (!g_file_set_contents (filename,
                                  msg->response_body->data,
                                  msg->response_body->length,
diff --git a/plugins/steam/gs-plugin-steam.c b/plugins/steam/gs-plugin-steam.c
index daa58e8..b50089b 100644
--- a/plugins/steam/gs-plugin-steam.c
+++ b/plugins/steam/gs-plugin-steam.c
@@ -389,8 +389,6 @@ gs_plugin_steam_download_icon (GsPlugin *plugin,
                        return FALSE;
                }
        } else {
-               if (!gs_mkdir_parent (cache_fn, error))
-                       return FALSE;
                if (!gs_plugin_download_file (plugin,
                                              NULL, /* GsApp */
                                              uri,


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