Re: Sandboxing: Can't bookmark enclosing folder of user-selected file

2013-12-25 Thread Leo

___

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

Re: Sandboxing: Can't bookmark enclosing folder of user-selected file

2013-12-23 Thread Mike Abdullah
Ah, does seem you're a bit stuck then. May be worth spending a DTS incident to 
see if you can get a definitive answer.

One workaround that comes to mind is you might be able to export your files 
such that they go:

 example.pdf = example.processed.pdf


which would mean technically the extension has changed, but not the rest.

On 23 Dec 2013, at 00:04, Leo le...@rogers.com wrote:

 Thanks Mike,
 
 I did read it couple of times wondering if that's what I need.
 
 However, in the very beginning Apple clearly states that:
 
  The related items feature of App Sandbox lets your app access files that 
 have the same name as a user-chosen file, but a different extension. This 
 feature consists of two parts: a list of related extensions in the 
 application’s Info.plist file and code to tell the sandbox what you’re doing.
 
 In my case, the extension in most cases remains the same, while the file name 
 changes.
 
 So, unless I misunderstand Apple's description, it won't help me. 
 
 Or am I missing something here?
 
 
 Leo
 
 
 On 12/22/13, 5:45 PM, Mike Abdullah wrote:
 
 
  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 le...@rogers.com 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 (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/mabdullah%40karelia.com
 
 This email sent to mabdul...@karelia.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

Sandboxing: Can't bookmark enclosing folder of user-selected file

2013-12-22 Thread Leo

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 (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

Re: Sandboxing: Can't bookmark enclosing folder of user-selected file

2013-12-22 Thread Mike Abdullah
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 le...@rogers.com 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 (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/mabdullah%40karelia.com
 
 This email sent to mabdul...@karelia.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

Re: Sandboxing: Can't bookmark enclosing folder of user-selected file

2013-12-22 Thread Leo

___

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