Current value of `key`, or null when the key is absent.
(plistPath, key)
| 89 | |
| 90 | /** Current value of `key`, or null when the key is absent. */ |
| 91 | function readPlistString(plistPath, key) { |
| 92 | try { |
| 93 | return execFileSync( |
| 94 | "plutil", |
| 95 | ["-extract", key, "raw", "-o", "-", plistPath], |
| 96 | { encoding: "utf8" }, |
| 97 | ).trim(); |
| 98 | } catch { |
| 99 | return null; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | function writePlistString(plistPath, key, value) { |
| 104 | execFileSync("plutil", ["-replace", key, "-string", value, plistPath], { |