Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]
Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]
- Subject: Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]
- From: Lynn Barton <email@hidden>
- Date: Wed, 21 May 2008 21:22:36 -0700
- Thread-topic: 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:
This email sent to email@hidden