diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2016-08-01 21:44:49 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2016-08-02 12:41:41 +0100 |
commit | df73155d7ae7fa4386a4d987f332c11a45faef53 (patch) | |
tree | bc589ebfb0be32a9e79a56200567dbd678e6a8ef | |
parent | 7c74033ad75f97665366c1b373013abf9ae4b529 (diff) | |
download | appstream-glib-df73155d7ae7fa4386a4d987f332c11a45faef53.tar.gz |
as_store_from_file_internal: set up path data for the file itself
Otherwise, when it changes we'll just emit
As-WARNING **: no path data for /.../xmls
and not actually update its contents.
Closes: #124
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | libappstream-glib/as-store.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c index 9f0e1dc..7a29e28 100644 --- a/libappstream-glib/as-store.c +++ b/libappstream-glib/as-store.c @@ -1430,7 +1430,9 @@ as_store_watch_source_added (AsStore *store, const gchar *filename) /* we helpfully saved this */ dirname = g_path_get_dirname (filename); g_debug ("parsing new file %s from %s", filename, dirname); - path_data = g_hash_table_lookup (priv->appinfo_dirs, dirname); + path_data = g_hash_table_lookup (priv->appinfo_dirs, filename); + if (path_data == NULL) + path_data = g_hash_table_lookup (priv->appinfo_dirs, dirname); if (path_data == NULL) { g_warning ("no path data for %s", dirname); return; @@ -1524,13 +1526,6 @@ as_store_add_path_data (AsStore *store, return; } - /* check is a directory */ - if (!g_file_test (path, G_FILE_TEST_IS_DIR)) { - g_warning ("not adding path %s [%s:%s] as not a directory", - path, as_app_scope_to_string (scope), arch); - return; - } - /* check not already exists */ path_data = g_hash_table_lookup (priv->appinfo_dirs, path); if (path_data != NULL) { @@ -1606,6 +1601,7 @@ as_store_from_file_internal (AsStore *store, /* watch for file changes */ if (watch_flags > 0) { + as_store_add_path_data (store, filename, scope, arch); if (!as_monitor_add_file (priv->monitor, filename, cancellable, |