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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to