From 19a561ded2cadc14844e3bcb05306918d566c10c Mon Sep 17 00:00:00 2001 From: Atri Bhattacharya Date: Wed, 20 Jul 2016 20:17:01 +0200 Subject: [PATCH] Fix example to work with new and legacy appdata dirs. --- examples/solv/repoinfo_system_rpm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/solv/repoinfo_system_rpm.c b/examples/solv/repoinfo_system_rpm.c index b385d726..4926ecd2 100644 --- a/examples/solv/repoinfo_system_rpm.c +++ b/examples/solv/repoinfo_system_rpm.c @@ -27,7 +27,8 @@ # define PRODUCTS_PATH "/etc/products.d" #endif #ifdef ENABLE_APPDATA -# define APPDATA_PATH "/usr/share/appdata" +# define APPDATA_PATH "/usr/share/metainfo" +# define APPDATA_LEGACY_PATH "/usr/share/appdata" #endif static void @@ -101,6 +102,12 @@ read_installed_rpm(struct repoinfo *cinfo) fprintf(stderr, "appdata reading failed: %s\n", pool_errstr(pool)); return 0; } +#elif defined(ENABLE_APPDATA) && defined(APPDATA_LEGACY_PATH) + if (repo_add_appdata_dir(repo, APPDATA_LEGACY_PATH, REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE | REPO_USE_ROOTDIR)) + { + fprintf(stderr, "appdata reading from legacy dir failed: %s\n", pool_errstr(pool)); + return 0; + } #endif ofp = fopen(calc_cachepath(repo, 0, 0), "r"); if (repo_add_rpmdb_reffp(repo, ofp, REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE | REPO_USE_ROOTDIR)) -- 2.47.2