Re: File Kind -> Carbon?
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.