From 1cd3a3230cd11d259cb815e5f89b95d0903072c9 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sun, 4 Jun 2023 01:37:31 -0700 Subject: [PATCH] File Tree: Reduce monitoring to limited changes Only track new, removed, or renamed files. Tracking Xattr changes was apparently causing the tracker dialog to crash on things like the user changing file type associations, which either added or removed a per- file association xattr, or when clicking Change All, removed this xattr from all associated files tracked by Spotlight. Fixes #361 Signed-off-by: Christopher Snowhill --- FileTree/FileTreeDataSource.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FileTree/FileTreeDataSource.m b/FileTree/FileTreeDataSource.m index 593cf08c4..0d80d01c9 100644 --- a/FileTree/FileTreeDataSource.m +++ b/FileTree/FileTreeDataSource.m @@ -145,6 +145,13 @@ static NSURL *defaultMusicDirectory(void) { } - (void)pathDidChange:(NSString *)path flags:(FSEventStreamEventFlags)flags { + if(!(flags & (kFSEventStreamEventFlagItemCreated | + kFSEventStreamEventFlagItemRemoved | + kFSEventStreamEventFlagItemRenamed))) { + // We only care about changes that would affect whether a file exists, or has a new name + // Apparently, Xattr changes are causing crashes in this notification tracker, oops. + return; + } DLog(@"PATH DID CHANGE: %@", path); // Need to find the corresponding node...and call [node reloadPath], then [self reloadPathNode:node] PathNode *node;