我的应用程序在复制/删除"/Library/LaunchAgents/“中的plist文件时遇到问题,以便在选中/取消选中复选框时控制自动启动功能。
我制作了一个安装程序,它在“安装后操作”中有一个“打开文件”操作。安装后,应用程序成功启动,但当我选中复选框并输入管理员密码为所有用户启用“自动启动”时,自动启动.plist文件不会复制到/Library/LauchAgents/。如果我终止应用程序,然后手动重新打开应用程序,然后选中自动启动选项,则文件可以成功复制到文件夹中。
下面是我用来将文件复制到"/Library/LauchAgents/“的AppleScript。我确信源路径和目标路径是正确的。
do shell script "cp '<sourcepath>' '<destinpath>'" with administrator privilege以下是我在控制台中得到的错误消息:
9/30/11 11:12:18.217 AM authorizationhost: SFBuiltinEntitled: Installer.app is not entitled for system.install.app-store-software
9/30/11 11:12:18.219 AM com.apple.SecurityServer: Failed to authorize right 'system.install.app-store-software' by client '/System/Library/PrivateFrameworks/PackageKit.framework/Versions/A/Resources/installd' [2042] for authorization created by '/System/Library/CoreServices/Installer.app' [2033]
9/30/11 11:12:18.277 AM installd: PackageKit:
----- Begin install -----
9/30/11 11:12:19.977 AM MyAppDemo: awakeFromNib()
9/30/11 11:12:20.007 AM installd: Installed "My Application Package" ()
9/30/11 11:12:20.035 AM installd: PackageKit:
----- End install -----发布于 2011-10-16 12:43:02
正确的代码是:
do shell script "cp '<sourcepath>' '<destinpath>'" with administrator privileges请注意特权的末尾有一个's‘。您的脚本在运行时一定有错误,因为拼写错误。
https://stackoverflow.com/questions/7609112
复制相似问题