1

I am Developing the zip extractor app in cocoa for which i'm using findersync to show context menu item. But, the problem is item is showing for every file i want to show only for .zip files so how do i do that .

Any Suggestion.

Thanks in Advance!

premkolindala
  • 161
  • 10

2 Answers2

2

Consider adding a service instead. That will allow you to add your item for any file not just those in monitored folders. The plist entries for a service allow you to directly specify what file types are acceptable, i.e. Restrict the service to ZIP files

CRD
  • 52,522
  • 5
  • 70
  • 86
1

Try this

NSURL *selectedURL = FIFinderSyncController.defaultController.selectedItemURLs[0];
NSURL *fileURL = selectedURL.filePathURL;
if([fileURL.pathExtension isEqualToString:@"zip"]) {
  NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
  NSMenuItem *item = [menu addItemWithTitle:@"Hello" action:@selector(itemTarget:) keyEquivalent:@""];
  item.target = self;        
  return menu;
}