mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 05:15:40 +03:00
OS X: White-list the folder watcher enums
I got syncs triggered for even opening a file by double clicking it in Finder and having launched Preview.app (e.g. for JPEG files).
This commit is contained in:
parent
ebbe5acf2b
commit
51f8a59a9a
1 changed files with 15 additions and 1 deletions
|
@ -51,6 +51,14 @@ static void callback(
|
|||
Q_UNUSED(eventFlags)
|
||||
Q_UNUSED(eventIds)
|
||||
|
||||
const FSEventStreamEventFlags c_interestingFlags
|
||||
= kFSEventStreamEventFlagItemCreated // for new folder/file
|
||||
| kFSEventStreamEventFlagItemRemoved // for rm
|
||||
| kFSEventStreamEventFlagItemInodeMetaMod // for mtime change
|
||||
| kFSEventStreamEventFlagItemRenamed // also coming for moves to trash in finder
|
||||
| kFSEventStreamEventFlagItemModified; // for content change
|
||||
//We ignore other flags, e.g. for owner change, xattr change, Finder label change etc
|
||||
|
||||
qDebug() << "FolderWatcherPrivate::callback by OS X";
|
||||
|
||||
QStringList paths;
|
||||
|
@ -62,8 +70,14 @@ static void callback(
|
|||
CFIndex pathLength = CFStringGetLength(path);
|
||||
qstring.resize(pathLength);
|
||||
CFStringGetCharacters(path, CFRangeMake(0, pathLength), reinterpret_cast<UniChar *>(qstring.data()));
|
||||
QString fn = qstring.normalized(QString::NormalizationForm_C);
|
||||
|
||||
paths.append(qstring.normalized(QString::NormalizationForm_C));
|
||||
if (!(eventFlags[i] & c_interestingFlags)) {
|
||||
qDebug() << "Ignoring non-content changes for" << fn;
|
||||
continue;
|
||||
}
|
||||
|
||||
paths.append(fn);
|
||||
}
|
||||
|
||||
reinterpret_cast<FolderWatcherPrivate*>(clientCallBackInfo)->doNotifyParent(paths);
|
||||
|
|
Loading…
Reference in a new issue