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 <kode54@gmail.com>
main
Christopher Snowhill 2023-06-04 01:37:31 -07:00
parent a640627fe1
commit dd630ba394
No known key found for this signature in database
1 changed files with 7 additions and 0 deletions

View File

@ -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;