Skip to content

Commit

Permalink
feat: reading preferences on disk will reset file if error (closes #73)
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Pontoise committed Nov 11, 2019
1 parent d275fc0 commit 39677fe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion alt-tab-macos/logic/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit 39677fe

Please sign in to comment.