Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]



I am trying to build a list of files found on my hard disk that pass a
certain filter (predicate). Mostly my code works, but I want to get the
modification date and the type code of each file. I am getting the date OK,
but not the type code, which should be ³TEXT² for text files and might be
³WBBN² for a Microsoft Word document. Here is part of the code of my
controller:

NSFileManager *defMgr = [NSFileManager defaultManager];
NSDirectoryEnumerator *dirEnum =
    [defMgr enumeratorAtPath:placeToSearch];
while (file = [dirEnum nextObject]) {
    fileAttr = [dirEnum fileAttributes];
    hfsFileType = [fileAttr valueForKey:NSFileHFSTypeCode];
    modDate = [fileAttr valueForKey:NSFileModificationDate];

Can anyone tell me what is wrong?

And by the way, how do I convert hfsFileType into a string? (Maybe I can
figure that one out myself from the documentation.)

Lynn
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.