1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-04 21:05:27 +03:00

Remove all links of an OPK when moved out of the monitored folder

It was previously removing only one link, but an OPK can provide
multiples links.
This commit is contained in:
Paul Cercueil 2013-07-18 16:29:56 -04:00
parent 13b3d8e0ca
commit dfad7c39a7

View File

@ -541,6 +541,8 @@ void Menu::readPackages(std::string parentDir)
#ifdef ENABLE_INOTIFY
void Menu::removePackageLink(std::string path)
{
bool found = false;
for (vector< vector<Link*> >::iterator section = links.begin();
section < links.end(); section++) {
for (vector<Link*>::iterator link = section->begin();
@ -549,19 +551,21 @@ void Menu::removePackageLink(std::string path)
if (!app || !app->isOpk() || app->getOpkFile().empty())
continue;
if (app->isOpk() && app->getOpkFile().compare(path) == 0) {
if (app->getOpkFile().compare(path) == 0) {
DEBUG("Removing link corresponding to package %s\n",
app->getOpkFile().c_str());
section->erase(link);
if (section - links.begin() == iSection
&& iLink == (int) section->size())
setLinkIndex(iLink - 1);
return;
found = true;
link--;
}
}
}
ERROR("Unable to find link corresponding to %s\n", path.c_str());
if (!found)
ERROR("Unable to find link corresponding to %s\n", path.c_str());
}
#endif
#endif