feat: reading preferences on disk will reset file if error (closes #73)

This commit is contained in:
Louis Pontoise committed 2019-11-11 14:39:40 +09:00
1 parent d275fc03ff
commit 39677fe542
1 file changed
+4 -1
+4 -1
View File
@@ -68,7 +68,10 @@ class Preferences {
.forEach { try updateAndValidateFromString($0.key, $0.value) }
} catch {
debugPrint("Error loading preferences", error)
NSApp.terminate(NSApplication.shared)
if (FileManager.default.fileExists(atPath: userFile.path)) {
try! FileManager.default.removeItem(at: userFile)
}
loadFromDiskAndUpdateValues()
}
}