Fix polling file system watcher addPaths

Fixes QFileSystemWatcher::addPath() auto test when polling file system
watcher is in use: adding the same path twice should fail.

Change-Id: I2a0df3ffa587fa90fae744858f4471d667443e6f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
This commit is contained in:
Bernd Weimer 2014-04-10 15:31:48 +02:00 committed by The Qt Project
parent d0cf69eaff
commit 2ba9a2584f

View File

@ -65,14 +65,16 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
if (!fi.exists())
continue;
if (fi.isDir()) {
if (!directories->contains(path))
directories->append(path);
if (directories->contains(path))
continue;
directories->append(path);
if (!path.endsWith(QLatin1Char('/')))
fi = QFileInfo(path + QLatin1Char('/'));
this->directories.insert(path, fi);
} else {
if (!files->contains(path))
files->append(path);
if (files->contains(path))
continue;
files->append(path);
this->files.insert(path, fi);
}
it.remove();