Lion 'Gotcha' #1: Creating a Support Folder

Ken Ray kray at sonsothunder.com
Thu Jul 21 19:52:08 EDT 2011


put (specialFolderPath("asup") & "/Test") into tSupportFolder
create folder tSupportFolder

This works under Snow Leopard if you are a logged-in admin user without error, and it assigns the currently logged-in user as the owner of the folder. 

In Lion, you get a "can't create that directory" error in the result. The workaround is to prompt for a password via AppleScript:

put "do shell script" && quote & "mkdir '" & tSupportFolder & \
    "'" & quote && "with administrator privileges" into tScript
do tScript as "AppleScript"
if the result <> (quote & quote) then
  -- report the AppleScript error
end if

Note that the resulting folder is owned by 'system' not the logged-in user, so you'll need to 'chmod' and 'chown' if you want to set the privileges back to what it was pre-Lion.

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/	




More information about the use-livecode mailing list