1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-02 18:05:26 +03:00

Remove all links of an "apps" dir when it is removed or renamed

This commit is contained in:
Paul Cercueil 2013-07-18 21:34:03 -04:00
parent f308ed983b
commit 5e7bcf3a1f
2 changed files with 10 additions and 1 deletions

View File

@ -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<Link*> >::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);

View File

@ -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))