Re: Sandboxing: Can't bookmark enclosing folder of user-selected file
Re: Sandboxing: Can't bookmark enclosing folder of user-selected file
- Subject: Re: Sandboxing: Can't bookmark enclosing folder of user-selected file
- From: Mike Abdullah <email@hidden>
- Date: Sun, 22 Dec 2013 22:45:37 +0000
Sounds to me you like you want to read up on the "Related Items" feature of the sandbox.
On 22 Dec 2013, at 09:38, Leo <email@hidden> wrote:
> I'm sandboxing an app for the first time. The app has been out for a few years by now, non-sandboxed.
>
> The app receives batches of PDF files and exports them with some changes. Users can select files from NSOpenPanel or drag-and-drop.
>
> There are two options:
>
> -export files into a specific folder, or
> -export each file into its original folder.
>
> The first option works with no problem: users select a destination folder in NSOpenPanel, I create and then resolve the bookmark for this folder. Files are being exported there as expected.
>
>
> However, I'm not sure how to deal with the second option when each file should be exported to its original enclosing folder.
>
> I tried to create a bookmark for file's enclosing folder when users add the files:
>
> NSURL *url = [NSURL fileURLWithPath:[filePath stringByDeletingLastPathComponent]];
>
> NSData *bookmarkData = [url
> bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
> includingResourceValuesForKeys:nil
> relativeToURL:nil
> error:&err];
>
> However, it results in this error: "The file “<enclosing folder name>” couldn’t be opened."
>
> As far as I understand, it happens because user selects the file, which still doesn't grant the right to bookmark its enclosing folder.
>
>
> If I create a bookmark for file's URL, I can't use this bookmark to export the file: the bookmark doesn't grant permissions to the enclosing folder.
>
>
> I did some extensive research and experimented with different options with no luck.
>
>
> What am I missing? How can I bookmark the enclosing folder of user-selected file (if at all)?
>
>
> Any help will be appreciated!
>
>
> Thanks,
> Leo
>
> _______________________________________________
>
> 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