mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 18:58:25 +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('.');
|
||||
opkMount = opkMount.substr(0, pos);
|
||||
|
||||
file = gmenu2x->getHome() + "/sections/";
|
||||
|
||||
appTakesFileArg = false;
|
||||
category = "applications";
|
||||
|
||||
while ((ret = opk_read_pair(opk, &key, &lkey, &val, &lval))) {
|
||||
if (ret < 0) {
|
||||
@ -139,7 +138,6 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable)
|
||||
pos = category.find(';');
|
||||
if (pos != category.npos)
|
||||
category = category.substr(0, pos);
|
||||
file += category + '/' + opkMount;
|
||||
|
||||
} else if ((!strncmp(key, "Name", lkey) && title.empty())
|
||||
|| !strncmp(key, ("Name[" + gmenu2x->tr["Lng"] +
|
||||
@ -212,6 +210,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable)
|
||||
#endif /* HAVE_LIBXDGMIME */
|
||||
}
|
||||
|
||||
file = gmenu2x->getHome() + "/sections/" + category + '/' + opkMount;
|
||||
opkMount = (string) "/mnt/" + opkMount + '/';
|
||||
edited = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user