• 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
NSFileManager createDirectory… confusing docs.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFileManager createDirectory… confusing docs.


  • Subject: NSFileManager createDirectory… confusing docs.
  • From: John Joyce <email@hidden>
  • Date: Sun, 24 Feb 2013 00:57:26 +0900

A bit of trouble with the NSFileManager docs for the methods:
– createDirectoryAtURL:withIntermediateDirectories:attributes:error:
– createDirectoryAtPath:withIntermediateDirectories:attributes:error:

Both say:

Return Value
YES if the directory was created or already exists or NO if an error occurred.

Both say:

createIntermediates (the BOOL argument)
If YES, this method creates any non-existent parent directories as part of creating the directory in url. If NO, this method fails if any of the intermediate parent directories does not exist.


Both fail to indicate CLEARLY that the BOOL argument to withIntermediateDirectories must be YES or the to return value to be YES if the directory already exists.
Setting argument withIntermediateDirectories to NO causes a return value of NO and an error to be generated.

The docs do not seem clear on this. (not to me anyway).
If the directory you are creating is also considered an "intermediate parent" directory, that is just confusing.

Can anybody explain to me how this makes any sense?
My workaround while using createIntermediates as NO was to check the error code and userInfo.
But setting createIntermediates to YES gives no error if the directory exists.



_______________________________________________

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: NSFileManager createDirectory… confusing docs.
      • From: Ken Thomases <email@hidden>
    • Re: NSFileManager createDirectory… confusing docs.
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Problem with NSDatePicker in popover
  • Next by Date: Re: NSFileManager createDirectory… confusing docs.
  • Previous by thread: Re: Problem with NSDatePicker in popover (workaround)
  • Next by thread: Re: NSFileManager createDirectory… confusing docs.
  • Index(es):
    • Date
    • Thread