Fixes an issue in DirectoryWatcher where it stops listening for events after a batch deletion

This commit is contained in:
Salvador Guerrero 2016-07-19 23:24:18 -06:00
parent 92fa1b1884
commit 5be13279cb

View File

@ -108,7 +108,20 @@ protected:
DirectoryIterator end;
while (it != end)
{
entries[it.path().getFileName()] = ItemInfo(*it);
// DirectoryWatcher should not stop watching if it fails to get the info
// of a file, it should just ignore it.
try
{
entries[it.path().getFileName()] = ItemInfo(*it);
}
catch(const Poco::FileNotFoundException& fnfe)
{
// The file is missing, remove it from the entries so it is treated as
// deleted.
entries.erase(it.path().getFileName());
poco_unexpected();
}
++it;
}
}