Re: Trying to understand a permissions failure when writing to ~/Desktop
Re: Trying to understand a permissions failure when writing to ~/Desktop
- Subject: Re: Trying to understand a permissions failure when writing to ~/Desktop
- From: Roland King <email@hidden>
- Date: Thu, 28 Jan 2016 10:54:00 +0800
From the original mail
"Note this isn’t a sandboxed app, so that shouldn’t come into it.”
> On 28 Jan 2016, at 10:51, Alex Zavatone <email@hidden> wrote:
>
> According to the sandboxing docs, I recall that for sandboxing, there are a certain set of locations where you can save files to without requiring user permission. Your ~/Documents folder is one of them. IIRC, all other locations require user confirmation to save the files.
>
> Try saving to the docs folder and/or trying writing to the desktop with sandboxing disabled.
>
> On Jan 27, 2016, at 8:42 PM, Graham Cox <email@hidden> wrote:
>
>> I use -[NSData writeToURL:options:error] to write data to files in a location generally chosen by the user. That works fine.
>>
>> The default location is ~/Desktop, if the user fails to choose anything, or if the bookmark of the previously chosen location fails to resolve. However, when I try to write the file I get an error 513, ‘you don’t have permission’, underlying error 1, operation not permitted’. If the user chooses the Desktop themselves using the Open panel, it works fine.
>>
>> The ~/Desktop permissions seem to be OK - I have readwrite permission on that folder.
>>
>> So something is weird about the URL for ~/Desktop when I create it programatically as opposed to what NSOpenPanel returns. Note this isn’t a sandboxed app, so that shouldn’t come into it.
>>
>> I create the default URL thusly:
>>
>> NSURL* desktopURL = [[NSFileManager defaultManager] URLForDirectory:NSDesktopDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:&error];
>>
>>
>> I can’t see any obvious difference between the URL here and the one I get from NSOpenPanel, but there must be one.
>>
>>
>> Any ideas what the problem could be here?
>>
>> —Graham
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>>
>> 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
_______________________________________________
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