I wonder whether you want to do this in the first place. I had tried the
same thing on Windows, that is, checking write permission upfront. I ended
up with just writing and letting it fail if the permission was not granted.
Windows permission rules are very complicated and API is quite unfriendly.
I'm not sure how Mac is better in this regard. So just let OS do the same
work, if it can reject, then let it reject.

The key point is:
1. If the file is specified by user and through the Open/Save panel, then
it is already in the sandbox (the wider dynamic box on Mac).
2. If there is a failure, you'd better let user know what happens rather
than an silent second-guess or failure. And letting user try to open it in
the first place provides more clue to users what they have done cause the
failure.


2013/11/8 Oleg Krupnov <oleg.krup...@gmail.com>

> I’m trying to use -[NSFileManager isWritableFileAtPath:], but when it
> returns NO, I’d like to know if it’s “no” because the app simply
> doesn’t have access to this path due to sandboxing, or is it “no"
> because the file doesn’t have write permissions set in its file
> attributes?
>
> Is there a way to discriminate these two cases?
>
> Or more generally, is there a way to tell that an app does or does not
> have access to some file because of *sandboxing* (as opposed to file
> attributes)?
>
> Thanks!
>
> _______________________________________________
>
> 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/middle.fengdong%40gmail.com
>
> This email sent to middle.fengd...@gmail.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to