Re: folder entitlements EPERM


Ben Kennedy
 

On 25 Jan 2021, at 9:12 am, Gerriet M. Denkmann <gerriet@mdenkmann.de> wrote:

When my App shows an OpenPanel (with this un-opened folder), and the user clicks ok, then the open() works just fine.

The problem: there might be a lot of these folders, and clicking dozens of OpenPanel becomes tedious rather fast.
Presumably you could solicit access to the root of the volume once, and thereafter build URLs for the relevant subpaths based on the security-scoped URL returned by the panel.

Per https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW20 :

When a user of your app specifies they want to use a file or a folder, the system adds the associated path to your app’s sandbox. Say, for example, a user drags the ~/Documents folder onto your app’s Dock tile (or onto your app’s Finder icon, or into an open window of your app), thereby indicating they want to use that folder. In response, the system makes the ~/Documents folder, its contents, and its subfolders available to your app.
-ben

Join cocoa@apple-dev.groups.io to automatically receive all group messages.