Re: File Kind -> Carbon?
Re: File Kind -> Carbon?
- Subject: Re: File Kind -> Carbon?
- From: Rosyna <email@hidden>
- Date: Thu, 21 Mar 2002 22:44:34 -0700
Below might be better... (at least it's what I'd use)
I think it returns Document if the kind is unknown as of 10.1, in
below, it would return some weird things for some types (folders,
packages).
Ack, at 3/21/02, Marc Respass said:
NSString* MERKindFromPath(NSString *path) {
OSStatus status;
CFStringRef outKindString;
// KIND STRING for Finder kind
status = LSCopyKindStringForURL((CFURLRef)[NSURL fileURLWithPath:path] ,
&outKindString);
if(status == noErr) {
return [(NSString*)outKindString autorelease];
} else if(status == kLSDataUnavailableErr) {
return @"-unknown kind-";
} else {
return @"-error getting kind-";
}
return NULL;
}
Given the path to a file, this function returns an NSString with
the Finder kind string. Comments and criticism are welcome.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
---
Please include any previous correspondence in replies, it helps me
remember what we were talking about. Thanks.
_______________________________________________
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.