On Tue, Jan 10, 2012 at 1:39 AM, Tony Arnold <t...@thecocoabots.com> wrote: > Hi Rick, > > On 10/01/2012, at 7:49 PM, Rick C. wrote: > >> Just looking for confirmation, I can use NSFileManager isWritableAtPath: if >> I want to check if a directory can be written to correct? Or do I have to >> use attributesOfItemAtPath:error:? I don't need to change permissions just >> to see if it's writable. Thanks! > > I was of the understanding that Apple's recommendation was just to try the > operation you wanted to perform, and handle the error if there is one. This > is taken from the NSFileManager header, directly above the isWriteableAtPath: > declaration:
Preflighting parent directory permissions is useful so you don't offer the user the ability to do something you know is impossible. For example, if a folder is not writeable, you can disable the "Save" button, as long as you recheck often enough to reenable it when the permissions change in your favor. The opposite scenario, where you assume that you have permission to write a file because of results of a check you made some milliseconds ago, is the more problematic one. You need to be able to handle that. --Kyle Sluder _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com