From dfad7c39a7bcfb75c3a234f4cafcd9bb507c55d8 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 18 Jul 2013 16:29:56 -0400 Subject: [PATCH] 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. --- src/menu.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/menu.cpp b/src/menu.cpp index 0d21b57..a9519a2 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -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 >::iterator section = links.begin(); section < links.end(); section++) { for (vector::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