• 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: File Kind -> Carbon?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Kind -> Carbon?


  • Subject: Re: File Kind -> Carbon?
  • From: Marc Respass <email@hidden>
  • Date: Thu, 21 Mar 2002 23:58:50 -0500

Clark, this may help

NSString* MERKindFromPath(NSString *path) {
OSStatus status;
CFStringRef outKindString;
NSString *string;
// KIND STRING for Finder kind
status = LSCopyKindStringForURL((CFURLRef)[NSURL fileURLWithPath:path] ,
&outKindString);
if(status == noErr) {
string = [NSString stringWithString:(NSString *)outKindString];
CFRelease(outKindString);
} else if(status == kLSDataUnavailableErr) {
string = @"-unknown kind-";
} else {
string = @"-error getting kind-";
}
return string;
}

Given the path to a file, this function returns an NSString with the Finder kind string. Comments and criticism are welcome.

Hope this helps
Marc

On Thursday, March 21, 2002, at 11:12 PM, Clark Mueller wrote:

Hi everybody. I'm looking to retrieve a file's kind (i.e. "Microsoft Word 2001 Document"). The problem that I have is that, as far as I can tell, Cocoa's APIs only allow a developer to reach as far as finding out whether a file is a document, directory, volume, and the like, but not to retrieve the specific file kind as noted above. I know that this can be done via Carbon, but is there a Cocoa way to do this?

TIA.

---
Clark Mueller
email@hidden
---
http://www.finikin.com/
I resolve to stop procrastinating...starting tomorrow.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: File Kind -> Carbon?
      • From: Rosyna <email@hidden>
References: 
 >File Kind -> Carbon? (From: Clark Mueller <email@hidden>)

  • Prev by Date: File Kind -> Carbon?
  • Next by Date: Re: How do I change the Document window title?
  • Previous by thread: File Kind -> Carbon?
  • Next by thread: Re: File Kind -> Carbon?
  • Index(es):
    • Date
    • Thread