mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 18:53:09 +02:00
Be resilient against zero or multiple "Categories" OPK metadata keys
For zero keys, the OPK file itself would be parsed as a settings file. For multiple keys, all first categories would be appended to the path, leading to a much too deep directory.
This commit is contained in:
parent
7992d83e10
commit
3694deecf6
@ -120,9 +120,8 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable)
|
|||||||
pos = opkMount.rfind('.');
|
pos = opkMount.rfind('.');
|
||||||
opkMount = opkMount.substr(0, pos);
|
opkMount = opkMount.substr(0, pos);
|
||||||
|
|
||||||
file = gmenu2x->getHome() + "/sections/";
|
|
||||||
|
|
||||||
appTakesFileArg = false;
|
appTakesFileArg = false;
|
||||||
|
category = "applications";
|
||||||
|
|
||||||
while ((ret = opk_read_pair(opk, &key, &lkey, &val, &lval))) {
|
while ((ret = opk_read_pair(opk, &key, &lkey, &val, &lval))) {
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -139,7 +138,6 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable)
|
|||||||
pos = category.find(';');
|
pos = category.find(';');
|
||||||
if (pos != category.npos)
|
if (pos != category.npos)
|
||||||
category = category.substr(0, pos);
|
category = category.substr(0, pos);
|
||||||
file += category + '/' + opkMount;
|
|
||||||
|
|
||||||
} else if ((!strncmp(key, "Name", lkey) && title.empty())
|
} else if ((!strncmp(key, "Name", lkey) && title.empty())
|
||||||
|| !strncmp(key, ("Name[" + gmenu2x->tr["Lng"] +
|
|| !strncmp(key, ("Name[" + gmenu2x->tr["Lng"] +
|
||||||
@ -212,6 +210,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable)
|
|||||||
#endif /* HAVE_LIBXDGMIME */
|
#endif /* HAVE_LIBXDGMIME */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file = gmenu2x->getHome() + "/sections/" + category + '/' + opkMount;
|
||||||
opkMount = (string) "/mnt/" + opkMount + '/';
|
opkMount = (string) "/mnt/" + opkMount + '/';
|
||||||
edited = true;
|
edited = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user