Skip to content

Commit

Permalink
Bugfix: Do not report hardlink creation as a file change, which trigg…
Browse files Browse the repository at this point in the history
…ers reload of toplevel nodes, and in turn causes selection in object browser to be lost.
  • Loading branch information
peterb180369 committed May 14, 2015
1 parent db2fc88 commit e836f67
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions UKFSEventsWatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,32 @@ static void FSEventCallback(ConstFSEventStreamRef inStreamRef,
const FSEventStreamEventId inEventIds[])
{
UKFSEventsWatcher* watcher = (UKFSEventsWatcher*)inClientCallBackInfo;
const FSEventStreamEventFlags kFolderMetadataMod = kFSEventStreamEventFlagItemInodeMetaMod|kFSEventStreamEventFlagItemIsDir;

if (watcher != nil && [watcher delegate] != nil)
{
id delegate = [watcher delegate];

if ([delegate respondsToSelector:@selector(watcher:receivedNotification:forPath:)])
{
NSEnumerator* paths = [(NSArray*)inEventPaths objectEnumerator];
NSString* path;
NSArray* paths = (NSArray*)inEventPaths;
NSUInteger i = 0;

while (path = [paths nextObject])
for (NSString* path in paths)
{
[delegate watcher:watcher receivedNotification:UKFileWatcherWriteNotification forPath:path];
FSEventStreamEventFlags flags = inEventFlags[i];
i++;

[[[NSWorkspace sharedWorkspace] notificationCenter]
postNotificationName: UKFileWatcherWriteNotification
object:watcher
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path,@"path",nil]];
}
if (flags != kFolderMetadataMod) // PB 14.05.2015: Filter out creation of hardlinks
{
[delegate watcher:watcher receivedNotification:UKFileWatcherWriteNotification forPath:path];

[[[NSWorkspace sharedWorkspace] notificationCenter]
postNotificationName: UKFileWatcherWriteNotification
object:watcher
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path,@"path",nil]];
}
}
}
}
}
Expand Down

0 comments on commit e836f67

Please sign in to comment.