How to refresh Finder badges?

Hello,
In my FinderSync extension, I update file badges with the following instruction, but the Finder doesn't (always) refresh them.
[[FIFinderSyncController defaultController] setBadgeIdentifier:result forURL:[NSURL fileURLWithPath:normalizedPath]];

I tried without success to force the refresh with:
  [[NSWorkspace sharedWorkspace] noteFileSystemChanged:path];
  NSString *source = [NSString stringWithFormat:@"tell application \"Finder\" to update item (POSIX file \"%@\")", path];
     
  NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:source];
  if (appleScript != nil) {
    [appleScript executeAndReturnError:nil];
  }

Hiding then showing the files (chflags) doesn't work better.

I'm in macOs Big Sur.

Any idea to get around this bug?
Thank you.
Chris


Replies

I update file badges with the following instruction, but the Finder
doesn't (always) refresh them.

[[FIFinderSyncController defaultController] setBadgeIdentifier:result forURL:[NSURL fileURLWithPath:normalizedPath]];

Did you file a bug about that? What was the bug number?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Here it is: FB9110597 (Finder badges refresh issue)