Re: How to tell if a file is writable in sandboxed mode?
Re: How to tell if a file is writable in sandboxed mode?
- Subject: Re: How to tell if a file is writable in sandboxed mode?
- From: Dong Feng <email@hidden>
- Date: Sat, 09 Nov 2013 15:49:32 -0800
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 <email@hidden>
> 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 (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
_______________________________________________
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