Sandbox a folder

Hi, I’m making an app for making a lot of files out of a csv file. If the csv contains 25 rows then there will be 25 files stored in a specific folder…

and, with sandboxing you can easily get permission to a chosen file to save to, but how do I get permission to save new files in a folder that I have chosen… ?

movies, pictures, download and music under a user are easily done with app wrapper… but I would like to be able to store stuff other places…

Just look at how apple looks at it:

2.2
Here is how we found this bug:
We were unable to save outputs to detention folders other than ~/Movies.

But the sandboxing is very strict about getting access to folders. so how do I cheat this ?

cheers helge

The sandbox kit from ohanaware.com seems to fix the folder problem, just holding my fingers crossed…!

You’re missing the point Apple was trying to make.
They want you to use a Save Dialog.

Use the SelectFolderDialog

OK, I’ll do the selectFolderDialog… but it was also nice to have the recentitems as well…

But if the selectFolderDialg keeps access to a folder then of course that is the thing to do… I just never used it before… :slight_smile:

thanks guys.

It will give your application access to the folder for the duration of that lifecycle; but if you stuff it into the Recent Items (from the Sandbox Kit) it’ll hold on to it for you even when the application is restarted.

The other option is to create a Security-Scoped Bodgemark (OWBookmark), it doesn’t require that the folder show up in the Recent items menu, however it does require that you wrap even single call to the folder with a startAccessing call (The Sandbox Kit creates a token which can simply be destroyed to signal you’re finished with the file). It HAS to be done this way everytime you need access to the folder. If you create a token once and hold on to it, the OS will auto release it for you and this leads to container corruption.

So I wouldn’t recommend the Security-Scoped Bodgemarks, but I’m posting it as an alternative.