On May 22, 2008, at 5:08 PM, Quincey Morris wrote:


On May 22, 2008, at 16:37, Lynn Barton wrote:

I can't get the OSType code
with the key NSFileHFSTypeCode. Each time I try to access this data I get a
different result

Is it perhaps something to do with the fact that [fileAttributes objectForKey: NSFileHFSTypeCode] is documented to be a NSNumber object, so the actual type code would be [[fileAttributes objectForKey: NSFileHFSTypeCode] intValue]?

Since it's documented as returning an unsigned long, I'd use - unsignedLongValue or -[NSDictionary fileHFSTypeCode] which returns an OSType directly.

The OP also asked about converting this to a string, which you can do with NSFileTypeForHFSTypeCode() or UTCreateStringForOSType() if you're working with UTIs. Doing a Spotlight search for kMDItemContentType == public.plain-text might make more sense than iterating directories, unless you're only looking for files with a type code.

--
adam
_______________________________________________

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