feat: support macos "sudden termination"
More info: https://developer.apple.com/documentation/foundation/processinfo#1651129
This commit is contained in:
1 parent
404613607c
commit
671fdabe79
3 files changed
+5
-1
No files matched your search
@@ -30,5 +30,7 @@
|
|||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>ATSApplicationFontsPath</key>
|
<key>ATSApplicationFontsPath</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSSupportsSuddenTermination</key>
|
||||||
|
<string>true</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -130,7 +130,9 @@ class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func saveRawToDisk() throws {
|
static func saveRawToDisk() throws {
|
||||||
|
ProcessInfo.processInfo.disableSuddenTermination()
|
||||||
try saveToDisk(rawValues, userFile)
|
try saveToDisk(rawValues, userFile)
|
||||||
|
ProcessInfo.processInfo.enableSuddenTermination()
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func preferencesVersion(_ url: URL) throws -> Int {
|
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 + "'")
|
throw NSError.make(domain: "Preferences", message: "Please enter a valid value for '" + key + "'")
|
||||||
}
|
}
|
||||||
try Preferences.updateAndValidateFromString(key, newValue)
|
try Preferences.updateAndValidateFromString(key, newValue)
|
||||||
(App.shared as! App).initPreferencesDependentComponents()
|
|
||||||
try Preferences.saveRawToDisk()
|
try Preferences.saveRawToDisk()
|
||||||
|
(App.shared as! App).initPreferencesDependentComponents()
|
||||||
} catch let error {
|
} catch let error {
|
||||||
debugPrint("PreferencesWindow: save: error", key, newValue, error)
|
debugPrint("PreferencesWindow: save: error", key, newValue, error)
|
||||||
showSaveErrorSheetModal(error as NSError, senderControl, key, previousValue) // allows recursive call by user choice
|
showSaveErrorSheetModal(error as NSError, senderControl, key, previousValue) // allows recursive call by user choice
|
||||||
|
|||||||
Reference in new issue
Block a user