problems copying an item from Resources to /tmp

Hi-

i’m having TONS of trouble copying an image file from the Resources folder of my app to /tmp. i’ve tried lots of code variations using POSIX path, quoted form of, etc - all giving different errors. Here is my current broken code:

property imageBackgroundPath : “Contents/Resources/imagebackground.jpg”

set moveBackground to POSIX path of ((“cp " & (path to me) & imageBackgroundPath & " /tmp”) as string)
do shell script moveBackground

this code puts a ‘/’ before the ‘cp’. A large part of the problem is that there are spaces in (path to me). i just need to copy the files and i’d like to not involve Finder copy if possible. is there a better (or simply correct) way to do this?

You’ve got the cp command in the path when it shouldn’t be. You should also quote the path in case there are spaces or other illegal characters in the path and, finally, you can use the properties of the main bundle to find the resource path:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

that got me close and i figured the rest out. thanks!