• 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
Re: checking if directory is writable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checking if directory is writable


  • Subject: Re: checking if directory is writable
  • From: Kyle Sluder <email@hidden>
  • Date: Thu, 12 Jan 2012 22:27:28 -0800

On Tue, Jan 10, 2012 at 1:39 AM, Tony Arnold <email@hidden> 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 (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

References: 
 >checking if directory is writable (From: "Rick C." <email@hidden>)
 >Re: checking if directory is writable (From: Tony Arnold <email@hidden>)

  • Prev by Date: Re: checking if directory is writable
  • Next by Date: Re: Is slowing down bindings updates possible?
  • Previous by thread: Re: checking if directory is writable
  • Next by thread: NSTimer and touch events
  • Index(es):
    • Date
    • Thread