Fix nvram theme setting

Themes with blank spaces in the middle was not possible. This commit fix it by quoting the string passed to nvrm
This commit is contained in:
vectorsigma72 2020-04-07 16:38:38 +02:00
parent c8969630f3
commit 166dcaa7ba
2 changed files with 8 additions and 2 deletions

View File

@ -30,6 +30,12 @@ extension String {
return data return data
} }
/// - returns: A quoted string for nvram
var nvramString: String {
return "'\(self)'"
}
/// - returns: Bool value indicating that our string start with the same prefix ignoring casing. /// - returns: Bool value indicating that our string start with the same prefix ignoring casing.
func hasPrefixIgnoringCase(_ str: String) -> Bool { func hasPrefixIgnoringCase(_ str: String) -> Bool {
return self.lowercased().hasPrefix(str.lowercased()) return self.lowercased().hasPrefix(str.lowercased())

View File

@ -943,9 +943,9 @@ final class SettingsViewController:
if nvramValue != theme { if nvramValue != theme {
if theme.count == 0 { if theme.count == 0 {
deleteNVRAM(key: key) deleteNVRAM(key: key.nvramString)
} else { } else {
setNVRAM(key: key, stringValue: theme) setNVRAM(key: key, stringValue: theme.nvramString)
} }
} else { } else {
return return