File watcher: ignore missing files/folders to prevent 'deleted' events later.

This commit is contained in:
Matthias Koefferlein 2017-04-20 00:09:03 +02:00
parent 2dd03c0e37
commit 9c2c3301cf
1 changed files with 5 additions and 3 deletions

View File

@ -85,11 +85,13 @@ FileSystemWatcher::add_file (const std::string &path)
QDateTime time; QDateTime time;
QFileInfo fi (tl::to_qstring (path)); QFileInfo fi (tl::to_qstring (path));
if (fi.exists ()) { if (! fi.exists () || ! fi.isReadable ()) {
size = size_t (fi.size ()); return;
time = fi.lastModified ();
} }
size = size_t (fi.size ());
time = fi.lastModified ();
std::map<std::string, FileEntry>::iterator i = m_files.find (path); std::map<std::string, FileEntry>::iterator i = m_files.find (path);
if (i != m_files.end ()) { if (i != m_files.end ()) {
i->second.refcount += 1; i->second.refcount += 1;