Should they be using any special file write API to additionally
support File Quarantine?
Nope. Consider this snippet:
let s = """
#! /bin/sh
echo 'Hello Cruel World!'
"""
let u = FileManager
.default
.homeDirectoryForCurrentUser
.appendingPathComponent("test.command")
.absoluteURL
try! s.write(to: u, atomically: true, encoding: .utf8)
_ = chmod(u.path, 0o755)
If LSFileQuarantineEnabled
is not present, the resulting ~/test.command
file opens and runs in Terminal. If it is, Terminal stops with a Gatekeeper alert.
Having said that, there are advantages in applying quarantine directly (using the .quarantinePropertiesKey
property) in that it gives you more control.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"