-1

I'm building custom Cloud-based storage access solution on top of OSX FUSE. Everything works fine, however there is a problem with Finder, which tries to download all the files in folder to build file icons.

Does anyone know a good and reliable programmatical way (i.e. coded in my Cocoa application) of disallowing Finder of doing this? Code based on building .DS_Store files, or based on Finder code injection will also be a good solution.

Nickolay Olshevsky
  • 13,706
  • 1
  • 34
  • 48
  • In case this is still relevant, see: http://stackoverflow.com/questions/31912769/osxfuse-how-to-distinguish-open-file-from-preview-in-finder I would not recommend on injection at this point of OSX future – Mugen Aug 26 '15 at 10:52
  • Actually I did it with Finder code injection (it is also needed for other features of the application). Now investigating will it work with El Capitan. – Nickolay Olshevsky Aug 27 '15 at 12:37
  • Unfortunately, injection will not work with El Capitan. If you do succeed to inject, I'll be happy to know how :) – Mugen Aug 27 '15 at 12:38
  • Yeah, it seems there is no way unless seeking for hacks/exploits which is not the way I'd like to use. So now will need to make Finder Sync plugin + detect quick view read requests to disable downloading of all the data from the cloud. The other possible way is using Apple Script, but I don't like it. – Nickolay Olshevsky Aug 27 '15 at 19:11
  • How would you detect quick view read requests? – Mugen Aug 27 '15 at 22:22
  • I didn't try it in practice, but now the idea is about call stack. Once you can get that QuickLook (or how that library is called) is on call stack, you can deny that fuse call. – Nickolay Olshevsky Aug 27 '15 at 22:40

1 Answers1

0

There is one way to filter out finder callbacks. You can get a context from any FUSE delegate callback. From that context you can get app bundle id, which can be used to filter out calls from finder.

Finder should have bundle id "com.apple.finder"

But, for example, if you will try to archive something in your drive, finder will came with exact the same bundle id. So enabling such filtering will broke archiving, and probably something else.

BTW- "com.apple.appkit.xpc.openAndSavePanelService" open and save panel will also read files to build icons.

NSDictionary *context = [GMUserFileSystem currentContext];
pid_t pid = [context[kGMUserFileSystemContextProcessIDKey] intValue];

NSRunningApplication *appFromPid = [NSRunningApplication runningApplicationWithProcessIdentifier:pid];
NSString *bundleId = appFromPid.bundleIdentifier;
DoN1cK
  • 595
  • 7
  • 22