[gnome-software] appstream: Do not fail if any of the metadata directories doesn't exist
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] appstream: Do not fail if any of the metadata directories doesn't exist
- Date: Mon, 27 Apr 2020 13:03:59 +0000 (UTC)
commit 8ed7a1ecbe1b9c7bceac96be61a2c5adb8676e5c
Author: Matthias Klumpp <matthias tenstral net>
Date: Mon Apr 27 13:38:50 2020 +0200
appstream: Do not fail if any of the metadata directories doesn't exist
This resolves issue #967
plugins/core/gs-plugin-appstream.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 6ba3aaca..548f03eb 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -173,12 +173,15 @@ gs_plugin_appstream_load_appdata (GsPlugin *plugin,
GError **error)
{
const gchar *fn;
- g_autoptr(GDir) dir = g_dir_open (path, 0, error);
+ g_autoptr(GDir) dir = NULL;
g_autoptr(GFile) parent = g_file_new_for_path (path);
if (!g_file_query_exists (parent, cancellable))
return TRUE;
+
+ dir = g_dir_open (path, 0, error);
if (dir == NULL)
return FALSE;
+
while ((fn = g_dir_read_name (dir)) != NULL) {
if (g_str_has_suffix (fn, ".appdata.xml") ||
g_str_has_suffix (fn, ".metainfo.xml")) {
@@ -265,16 +268,14 @@ gs_plugin_appstream_load_desktop (GsPlugin *plugin,
{
const gchar *fn;
g_autoptr(GDir) dir = NULL;
- g_autoptr(GFile) parent = NULL;
+ g_autoptr(GFile) parent = g_file_new_for_path (path);
+ if (!g_file_query_exists (parent, cancellable))
+ return TRUE;
dir = g_dir_open (path, 0, error);
if (dir == NULL)
return FALSE;
- parent = g_file_new_for_path (path);
- if (!g_file_query_exists (parent, cancellable))
- return TRUE;
-
while ((fn = g_dir_read_name (dir)) != NULL) {
if (g_str_has_suffix (fn, ".desktop")) {
g_autofree gchar *filename = g_build_filename (path, fn, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]