mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 13:25:52 +03:00
Merge pull request #4939 from owncloud/osx_filewatcher_fix
OS X filewatcher fix
This commit is contained in:
commit
801cb42d57
1 changed files with 15 additions and 1 deletions
|
@ -51,6 +51,14 @@ static void callback(
|
||||||
Q_UNUSED(eventFlags)
|
Q_UNUSED(eventFlags)
|
||||||
Q_UNUSED(eventIds)
|
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";
|
qDebug() << "FolderWatcherPrivate::callback by OS X";
|
||||||
|
|
||||||
QStringList paths;
|
QStringList paths;
|
||||||
|
@ -62,8 +70,14 @@ static void callback(
|
||||||
CFIndex pathLength = CFStringGetLength(path);
|
CFIndex pathLength = CFStringGetLength(path);
|
||||||
qstring.resize(pathLength);
|
qstring.resize(pathLength);
|
||||||
CFStringGetCharacters(path, CFRangeMake(0, pathLength), reinterpret_cast<UniChar *>(qstring.data()));
|
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);
|
reinterpret_cast<FolderWatcherPrivate*>(clientCallBackInfo)->doNotifyParent(paths);
|
||||||
|
|
Loading…
Reference in a new issue