I am currently using SMJobBless to create a privileged helper tool. I want to change the "standard" location (/Library/PrivilegedHelperTools/) it uses and install it in /Library/myapp/. I tried to manually add ProgramArguments to my launchd plist with no success.
Is there any proper way to manipulate plist in order to do that or I have to move the helper manually and creating the folder I want to use too?
Here is my swift code
var authItem = AuthorizationItem(name: kSMRightBlessPrivilegedHelper,
valueLength: 0, value: nil, flags: 0)
var myRights = AuthorizationRights(count: 1, items: &authItem)
let myFlags : AuthorizationFlags = [.interactionAllowed, .preAuthorize, .extendRights ]
var authRef: AuthorizationRef?
let osStatus = AuthorizationCreate(&myRights, nil, myFlags, &authRef)
if osStatus == errAuthorizationSuccess {
var error: Unmanaged<CFError>?
SMJobBless(kSMDomainSystemLaunchd, "com.company.HelperTool" as CFString, authRef, &error)
/
if (error != nil) {
print(error)
}
}