diff --git a/src/menu.cpp b/src/menu.cpp index 08e3f4f..00527a5 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -546,6 +546,9 @@ void Menu::readPackages(std::string parentDir) } #ifdef ENABLE_INOTIFY +/* Remove all links that correspond to the given path. + * If "path" is a directory, it will remove all links that + * correspond to an OPK present in the directory. */ void Menu::removePackageLink(std::string path) { for (vector< vector >::iterator section = links.begin(); @@ -556,7 +559,7 @@ void Menu::removePackageLink(std::string path) if (!app || !app->isOpk() || app->getOpkFile().empty()) continue; - if (app->getOpkFile().compare(path) == 0) { + if (app->getOpkFile().compare(0, path.size(), path) == 0) { DEBUG("Removing link corresponding to package %s\n", app->getOpkFile().c_str()); section->erase(link); diff --git a/src/monitor.cpp b/src/monitor.cpp index 05fedc0..631d931 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -58,6 +58,12 @@ int Monitor::run(void) char buf[256]; read(fd, &event, len); + + if (event.mask & (IN_DELETE_SELF | IN_MOVE_SELF)) { + inject_event(false, path.c_str()); + break; + } + sprintf(buf, "%s/%s", path.c_str(), event.name); if (!event_accepted(event))