I have finally resolved this problem. My original copyFolder handler used the Finder's duplicate command to copy folders and files into my application bundle's /Contents/Resources/ folder. The duplicate command isn't very smart, requiring the handler to be recursive. This handler also contained the line ...
set destAlias to (folder itemName of contentsDest) as alias
which caused an error if the temporary items folder was not open in Lion. (I have filed this as bug id 10009144.)
To fix my script, I modified the copyFolder handler so that it is no longer recursive and, instead of the duplicate command, I used ...
repeat with sourceAlias in contentFolderList tell application "Finder" set folderName to (name of sourceAlias) as text if not (exists folder folderName in contentsDest) then set destAlias to make new folder at contentsDest with properties {name:folderName} else set destAlias to (folder folderName of contentsDest) as alias end if end tell -- set sourcePath to (quoted form of (POSIX path of sourceAlias)) set destPath to (quoted form of (POSIX path of destAlias)) do shell script "ditto " & sourcePath & space & destPath end repeat
The 'ditto' command is smart enough to know not to remove files and folders that already exist at the destination, hence no need for recursion.
My "Script Bundle Tool" is now working correctly in both Lion and previous systems. I will release version 4.3 soon.
|