Thread-topic: Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]
User-agent: Microsoft-Entourage/12.10.0.080409
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