[Pkg-owncloud-commits] [owncloud-client] 06/121: OS X: White-list the folder watcher enums
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Jul 28 15:31:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 51f8a59a9a16fa9fe02b83f82447a93e5719575e
Author: Markus Goetz <markus at woboq.com>
Date: Thu Jun 2 18:12:47 2016 +0200
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).
---
src/gui/folderwatcher_mac.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/gui/folderwatcher_mac.cpp b/src/gui/folderwatcher_mac.cpp
index ada7f10..be42608 100644
--- a/src/gui/folderwatcher_mac.cpp
+++ b/src/gui/folderwatcher_mac.cpp
@@ -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);
+
+ if (!(eventFlags[i] & c_interestingFlags)) {
+ qDebug() << "Ignoring non-content changes for" << fn;
+ continue;
+ }
- paths.append(qstring.normalized(QString::NormalizationForm_C));
+ paths.append(fn);
}
reinterpret_cast<FolderWatcherPrivate*>(clientCallBackInfo)->doNotifyParent(paths);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list