• 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
Re: NSFileManager and directories
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSFileManager and directories


  • Subject: Re: NSFileManager and directories
  • From: Dustin Voss <email@hidden>
  • Date: Thu, 4 Sep 2003 09:09:14 -0700

On Thursday, September 4, 2003, at 12:25 AM, Francisco Tolmasky wrote:

Is saying something like
NSArray *contents;
if(contents= [[NSFileManager defaultManager] directoryContentsAtPath: aPath])
//do directory stuff
else
//do file stuff

a safe way to tell if the object at "aPath" is a directory or not?

One way to do this, that handles sym-links, is NSFileManager fileAttributesAtPath:traverseLink:.

BOOL isDir = [ [[[NSFileManager defaultManager] fileAttributesAtPath:aPath traverseLink:YES] fileType] isEqualToString:NSFileTypeDirectory ];
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >NSFileManager and directories (From: Francisco Tolmasky <email@hidden>)

  • Prev by Date: Re: NSFileWrapper limitation
  • Next by Date: Re: Split Buttons: How do I make em?
  • Previous by thread: Re: NSFileManager and directories
  • Next by thread: Sending email with attachments
  • Index(es):
    • Date
    • Thread