feat: support macos "sudden termination"

More info: https://developer.apple.com/documentation/foundation/processinfo#1651129
This commit is contained in:
louis.pontoise authored and lwouis committed 2020-03-10 14:00:37 +09:00
1 parent 404613607c
commit 671fdabe79
3 files changed
+5 -1

No files matched your search

+2
View File
@@ -30,5 +30,7 @@
<string>1</string>
<key>ATSApplicationFontsPath</key>
<string></string>
<key>NSSupportsSuddenTermination</key>
<string>true</string>
</dict>
</plist>
+2
View File
@@ -130,7 +130,9 @@ class Preferences {
}
static func saveRawToDisk() throws {
ProcessInfo.processInfo.disableSuddenTermination()
try saveToDisk(rawValues, userFile)
ProcessInfo.processInfo.enableSuddenTermination()
}
private static func preferencesVersion(_ url: URL) throws -> Int {
@@ -35,8 +35,8 @@ class PreferencesWindow: NSWindow {
throw NSError.make(domain: "Preferences", message: "Please enter a valid value for '" + key + "'")
}
try Preferences.updateAndValidateFromString(key, newValue)
(App.shared as! App).initPreferencesDependentComponents()
try Preferences.saveRawToDisk()
(App.shared as! App).initPreferencesDependentComponents()
} catch let error {
debugPrint("PreferencesWindow: save: error", key, newValue, error)
showSaveErrorSheetModal(error as NSError, senderControl, key, previousValue) // allows recursive call by user choice