C-Command Software Forum

Copy Files to Location Other than Application Folder

I have a file that is an application add-on that I have been able to successfully package in a DropDMG DMG file with layout, license, etc. The only problem is that I can’t provide an easy way for users to be able to drag and drop the file to the necessary location for them to use it.

Originally I had created an alias and placed it in the folder of the DMG package’s contents, then placed an “icon” with the same name in the layout. When I create the DMG everything comes out perfectly in terms of appearances, except that when you click on the folder icon it does not open the correct file location. The reason being that the alias is pointing to MY user account’s Documents folder, which when provided to other users doesn’t work since they don’t have the same username. This is similar to what I saw in this forum item: http://c-command.com/forums/showthread.php/3534-symlink-alias-to-Documents-folder

After looking around online I found a similar question & answer on a different site; http://stackoverflow.com/questions/3436079/mac-create-alias-for-dmg-file-without-fixed-user-in-it/3436104#3436104

The only issue is that I have no experience with AppleScript and don’t know how to apply the idea of an automated script that would copy the file from my DMG file to the correct location. If I could get some help translating the applescript example for copying the file in my DMG to a directory in the user’s Document/destination folder that would probably help me out. The main problem being that I’m not experienced with AppleScript.

Or if there’s an alternate method that would allow users to still drag the file to a “icon” that specifies the location, I’m fine with that too but from earlier posts I’m not sure if that’s possible. Any help is appreciated. Thanks.

If your add-on is an application, I would suggest that you have the user put it in the Applications folder. Then, when launched, it could automatically copy any needed files to the proper location.

The example script doesn’t use proper quoting, and it tries to move the file. I would suggest copying it, using a droplet script like this:

on open _file
    set _sourcePath to POSIX path of _file
    do shell script "cp -r " & _sourcePath's quoted form & " ~/Documents/"
end open