I know about Sandbox limitations and and my usual technique of having the user save a file is via the NSSavePanel, which automagically grants the app the necessary priviliges to the location, as indicated by the user.

Now, here's the... not-so-uncommon scenario :

  • User creates a new file, in my app
  • Saves is for the first time (so, there's a good reason for the NSSavePanel to show up)
  • Then edits the contents of the document (please, note that my app is not a typical NSDocument-compliant one)
  • And finally he want to re-save it. (not "Save (it) as.." but just... "Save (it)" - since he's already specified a location, right?)

How is this doable? What's the "approved" way of achieving that? I've read about bookmarks but a) I'm not sure whether it is what I need, b) I haven't managed to find any real code example.

So, any ideas?


Please, note : no-matter-what, the solution must be fully-functional for 10.6 as well.


UPDATE : Hmm... That's just weird (or at least unexpected). Just tried re-saving at a previous location already selected via NSSavePanel and it seems to be working (without doing anything). Is that possible? (And yep, just re-checked it twice : the app is sandboxed)

有帮助吗?

解决方案

You provided your own answer - “which automagically grants the app the necessary priviliges to the location, as indicated by the user” - when the user selects the file in the file panel the sandbox is extended to include the selected location and for the rest of the current execution your app my access it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top