On Oct 16, 2008, at 5:46 PM, [EMAIL PROTECTED] wrote:

I'm enumerating a folder and checking the extension but I would also like to check the type in case there is no extension. Like "AIFF Audio File" for .aif file. How do you do that?

The narrow answer to your question is: make an NSURL from the file path and pass it to LSCopyKindStringForURL (NSURL is toll-free bridged with CFURLRef).

However, you should consider working with UTIs (Uniform Type Identifiers) rather than checking either extensions or kind strings. Read up on UTIs here: <http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/ >.

You can use the NSWorkspace methods to check whether a file's UTI conforms to the type(s) you want to handle: -typeOfFile:error: and - type:conformsToType:. For AIFF audio, you want to check for conformance to the UTI "public.aiff-audio".

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to