• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Understand whether an application can open a specific file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Understand whether an application can open a specific file


  • Subject: Re: Understand whether an application can open a specific file
  • From: Giovanni Donelli <email@hidden>
  • Date: Sun, 2 Oct 2005 19:21:02 +0200

Thank you very much it does work!

Is there a specific manual for the launch services, something more than a reference manual?

thanks
Giovanni

On 2 Oct 2005, at 3:46 PM, glenn andreas wrote:


On Oct 2, 2005, at 8:35 AM, Giovanni Donelli wrote:


Dear Folks,
is there a clever way to figure out whether an application X can open a file Y or not?


I notice that if you drag, say a PDF file, over the icon of iCal in the finder, iCal doesn't highlight notifying the user that the application can't open that file.

is there a function such as: ApplicationCanOpenFileAtPath() ?


You'll need to drop down two Carbon, but LSCanURLAcceptURL in LaunchServices.h will do this, but it's pretty trivial:


NSURL *appUrl = [[[NSURL alloc] initFileURLWithPath:appPath] autorelease];
NSURL *docUrl = [[[NSURL alloc] initFileURLWithPath:docPath] autorelease];


Boolean acceptsItem;
if (LSCanURLAcceptURL((CFURLRef)docUrl, (CFURLRef)appUrl, kLSRolesAll, kLSAcceptDefault, &acceptsItem) == noErr) {
return acceptsItem;
}
return NO;
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Understand whether an application can open a specific file (From: Giovanni Donelli <email@hidden>)
 >Re: Understand whether an application can open a specific file (From: glenn andreas <email@hidden>)

  • Prev by Date: NSView -window Calling -display??
  • Next by Date: Unnecessary Invocations of outlineView:setObjectValue:forTableColumn:byItem:
  • Previous by thread: Re: Understand whether an application can open a specific file
  • Next by thread: Unnecessary Invocations of outlineView:setObjectValue:forTableColumn:byItem:
  • Index(es):
    • Date
    • Thread