Error in process Error Domain=NSCocoaErrorDomain Code=4 "The file “test.command” doesn’t exist."
I get the above error when I try to access the binary.
I use NSOpenPanel to allow the user to give permission to access the file system.
The program works perfectly without the sandbox and so that ensures there is no file path error.
I have the following entitlements:
com.apple.security.scripting-targets
com.apple.security.files.user-selected.executable
com.apple.security.files.user-selected.read-write
let task = Process()
task.launchPath = "/Users/test/test.command"
let openPanel = NSOpenPanel()
openPanel.prompt = "Choose"
openPanel.canChooseFiles = false
openPanel.canChooseDirectories = true
do{
try task.run()
}catch{
os_log(.error,"Error in process")
print(" \(error)")
}
What could be the issue ?