I am the author of Seafile's Finder Sync Extension code. Thanks for post the link to my code. I have improved the code overtime since the first publish.
The architecture is much simpler than what's the windows' explorer extension programming. Firstly you need to tell Finder (or FIFinderSyncController
) which directories you want to watch (via setting directoryURLs
), and the FIFinderSyncController
will callback via beginObservingDirectoryAtURL
when the user visits some directory in Finder. Then if the specific files in the directory are visited the first time after requestBadgeIdentifierForURL
call, you will be called back with requestBadgeIdentifierForURL
. You should record this information if you want to update the badge later. Finally you can set badge on your files whenever possible in the main queue via setBadgeIdentifier
.
Another important thing to mention is, as the official document says, that the Extension is running in another process (neither the threads from Finder nor those from your apps) and talking with Finder via XPC. And you might need to interact with your extension via some kind of IPC such as XPC or mach ports since the extension is required to be sandboxed.
I hope this information will help you with your code.