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:

"The following methods are of limited utility. Attempting to predicate behavior 
based on the current state of the filesystem or a particular file on the 
filesystem is encouraging odd behavior in the face of filesystem race 
conditions. It's far better to attempt an operation (like loading a file or 
creating a directory) and handle the error gracefully than it is to try to 
figure out ahead of time whether the operation will succeed."

(Sorry for the resend — my original reply only went to Rick, not the entire 
list)

all the best,


Tony




----------
Tony Arnold
http://thecocoabots.com/

_______________________________________________

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

Reply via email to