From: Michael Schroeder Date: Wed, 26 Feb 2014 17:15:01 +0000 (+0100) Subject: improve guessing of appdata.xml file name X-Git-Tag: 0.6.4~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6deb2df6c9379ac5444fffa5c1f70cafea440775;p=thirdparty%2Flibsolv.git improve guessing of appdata.xml file name --- diff --git a/ext/repo_appdata.c b/ext/repo_appdata.c index 96e114ca..3d0ebba4 100644 --- a/ext/repo_appdata.c +++ b/ext/repo_appdata.c @@ -368,8 +368,17 @@ endElement(void *userData, const char *name) break; case STATE_ID: pd->desktop_file = solv_strdup(pd->content); + /* guess the appdata.xml file name from the id element */ if (pd->lcontent > 8 && !strcmp(".desktop", pd->content + pd->lcontent - 8)) pd->content[pd->lcontent - 8] = 0; + else if (pd->lcontent > 4 && !strcmp(".ttf", pd->content + pd->lcontent - 4)) + pd->content[pd->lcontent - 4] = 0; + else if (pd->lcontent > 4 && !strcmp(".otf", pd->content + pd->lcontent - 4)) + pd->content[pd->lcontent - 4] = 0; + else if (pd->lcontent > 4 && !strcmp(".xml", pd->content + pd->lcontent - 4)) + pd->content[pd->lcontent - 4] = 0; + else if (pd->lcontent > 3 && !strcmp(".db", pd->content + pd->lcontent - 3)) + pd->content[pd->lcontent - 3] = 0; id = pool_str2id(pd->pool, pool_tmpjoin(pool, "appdata(", pd->content, ".appdata.xml)"), 1); s->requires = repo_addid_dep(pd->repo, s->requires, id, 0); id = pool_str2id(pd->pool, pool_tmpjoin(pool, "application-appdata(", pd->content, ".appdata.xml)"), 1);