views:

19

answers:

1

[NSFileManager createDirectoryAtPath:attributes:] gives me a warning that it is depreciated.

What is the alternative? Or is there a better way of doing this?

Thanks

Tom

+2  A: 

Use createDirectoryAtPath:withIntermediateDirectories:attributes:error:

P.S.

createIntermediates If YES, then the method will also create any necessary intermediate directories; if NO, then the method fails if any parent of the directory to be created does not exist. In addition, if you pass NO for this parameter, the directory must not exist at the time this call is made.

Vladimir
what would you pass to `withIntermediateDirectories` can you pass nil? What does it do?
Thomas Clayson
updated the answer with reference quote ;)
Vladimir
ah i see... so if you have a path to the folder you want to create like: *Documents/A/Directory/In/Here* and you set `withIntermediateDirectories` to NO then it will fail if any of the directories *A*,*Directory* and *In* don't exist. If YES then it will create them if they don't exist? Brilliant. Thank you.
Thomas Clayson