Copy file to local profile in MacOS

(imported topic written by SystemAdmin)

Hi all,

I’m attempting to install an application in MacOS that requires a plist file be copied into a local profile directory in Mac OS during its installation. The application uses a shell script to accomplish this task:

cp “$1/Contents/Resources/$UserPlistFile” "$HOME/Library/Preferences/

The problem is that when this is executed by TEM, which uses the root account, it ends up going into the main /Library/Preferences folder, not the locally logged in user.

One was I was thinking I could get around this, would be to allow the fixlet itself to copy the file over in the action script. To do this, I thought I could try the following:

parameter “currentUserHome” = “/Users/{name of current user}/Library/Preferences/”

move “{posix path of file “com.userplist.plist” of folder “__Download” of client folder of current site}” “{escape of parameter “currentUserHome”}com.userplist.plist”

However, I receive a “Relevance substitution failed” error in the client logs when it attempts to execute the move command (the currentUserHome parameter does execute correctly, and shows the appropriate path).

Interestingly, when I tried a test using the Fixlet debugger and substituting Windows paths for OSX paths, it seemed to work fine.

Does anyone have any suggestions on what may be going wrong? Or any alternative ways for doing this?

Many thanks!

(imported comment written by SystemAdmin)

I think I’ve got this one figured out. I was over complicating it, and needed to include the posix path command. Here’s what worked:

move “{posix path of file “com.userplist.plist” of folder “__Download” of client folder of current site}” “{posix path of users folder & “/” & name of current user & “/Library/Preferences/”}com.userplist.plist”

Hope this helps out someone else!

(imported comment written by SystemAdmin)

Just so its known, “posix path” and “pathname” are the same meaning (and pathname is the cross platform named version)

You can also shorten it a bit as the move actionscript runs from the current site

move "__Download/com.userplist.plist" "{home directory of current user as string & "/Library/Preferences/com.userplist.plist"}"