Commit fc73e6e67b4048a7fa79d041ee609bea508aff07

Re-enabled support for the FSEvents-based QFileSystemWatcher.

Also fixed it to use canonicalFilePath instead of absoluteFilePath since when
we get notification from the system, it gives us the canonical path with
resolved symlinks (for example when watching for /tmp, the notification that we
get says that /private/tmp was modified).

Reviewed-by: Prasanth
src/corelib/io/qfilesystemwatcher.cpp
(1 / 1)
  
248248 eng = QDnotifyFileSystemWatcherEngine::create();
249249 return eng;
250250#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
251# if 0 && (defined Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
251# if defined(Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
252252 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5)
253253 return QFSEventsFileSystemWatcherEngine::create();
254254 else
src/corelib/io/qfilesystemwatcher_fsevents.cpp
(5 / 5)
  
9494{
9595 PathInfoList &list = pathHash[key];
9696 list.push_back(PathInfo(path,
97 fileInfo.absoluteFilePath().normalized(QString::NormalizationForm_D).toUtf8()));
97 fileInfo.canonicalFilePath().normalized(QString::NormalizationForm_D).toUtf8()));
9898 pathHash.insert(key, list);
9999}
100100
206206 } else {
207207 directories->append(path);
208208 // Full file path for dirs.
209 QCFString cfpath(createFSStreamPath(fileInfo.absoluteFilePath()));
209 QCFString cfpath(createFSStreamPath(fileInfo.canonicalFilePath()));
210210 addPathToHash(dirPathInfoHash, cfpath, fileInfo, path);
211211 CFArrayAppendValue(tmpArray, cfpath);
212212 }
216216 continue;
217217 } else {
218218 // Just the absolute path (minus it's filename) for files.
219 QCFString cfpath(createFSStreamPath(fileInfo.absolutePath()));
219 QCFString cfpath(createFSStreamPath(fileInfo.canonicalPath()));
220220 files->append(path);
221221 addPathToHash(filePathInfoHash, cfpath, fileInfo, path);
222222 CFArrayAppendValue(tmpArray, cfpath);
293293 itemCount = CFArrayGetCount(tmpArray);
294294 const QString &path = paths.at(i);
295295 QFileInfo fi(path);
296 QCFString cfpath(createFSStreamPath(fi.absolutePath()));
296 QCFString cfpath(createFSStreamPath(fi.canonicalPath()));
297297
298298 CFIndex index = CFArrayGetFirstIndexOfValue(tmpArray, CFRangeMake(0, itemCount), cfpath);
299299 if (index != -1) {
302302 removePathFromHash(filePathInfoHash, cfpath, path);
303303 } else {
304304 // Could be a directory we are watching instead.
305 QCFString cfdirpath(createFSStreamPath(fi.absoluteFilePath()));
305 QCFString cfdirpath(createFSStreamPath(fi.canonicalFilePath()));
306306 index = CFArrayGetFirstIndexOfValue(tmpArray, CFRangeMake(0, itemCount), cfdirpath);
307307 if (index != -1) {
308308 CFArrayRemoveValueAtIndex(tmpArray, index);

Comments

Add a new comment:

Login or create an account to post a comment

Add your comment