• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]
      • From: Jens Alfke <email@hidden>
    • Re: Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Guidance for Cocoa's steep learning curve
  • Next by Date: Re: fundamental question: how do I call controller methods from other classes?
  • Previous by thread: Documenting and editing nib files was Re: Cocoa et al as HCI usability problem
  • Next by thread: Re: Can't get file type code using [fileAttr valueForKey:NSFileHFSTypeCode]
  • Index(es):
    • Date
    • Thread