Dear friends,
I am working my way thru apple’s sandbox requirements.
I have an app that used to write documents in the user’s documents folder, it sounds very reasonable to me.
But apple no longer wants me to do this.
I am obliged to write the users documents in a difficult to access by the ordinary user. LION hides the users documents folder.
I want to be elegant with my user, and so I have a menu that once clicked will “reveal” to the user where his documents are located, in case he wants to.
This is the code I used, before sandboxing…
on revealSelectedFolder_(sender)
(*** this handler will reveal the selected folder in Finder: ****)
set selectedFolder to theFolderArrayController's selectedObjects()'s lastObject()
set folderExists to filePresenter's validateFolderData_(theFolderArrayController's selectionIndex())
if folderExists as integer is 1 then
set chosen_directory to selectedFolder's valueForKey_("folderURL")
set chosen_directory to chosen_directory's |path|()
set chosen_directory to chosen_directory as string
tell application "Finder"
set chosen_directory to chosen_directory as POSIX file
--reveal chosen_directory
open chosen_directory
activate
end tell
else
log "error on revealing selected folder..."
end if
end revealSelectedFolder_
To sandbox my app, I can no longer talk to “Finder”.
I am studying File Manager Reference, and it seems that it is not capable of doing this.
I can read, count, manipulate the contents, but opening a folder to the user is difficult for me.
Can you please post me your suggestions?
Thanks!