fixing error in registerDefaults

This commit is contained in:
Shelley Vohr 2017-12-12 13:08:09 -05:00
parent 5720a8e7d5
commit 8b447b9291
No known key found for this signature in database
GPG key ID: F13993A75599653C
5 changed files with 68 additions and 1 deletions

View file

@ -144,6 +144,21 @@ v8::Local<v8::Value> SystemPreferences::GetUserDefault(
}
}
void SystemPreferences::RegisterDefaults(mate::Arguments* args) {
base::DictionaryValue value;
if(!args->GetNext(&value)) {
args->ThrowError("Invalid userDefault data provided");
} else {
@try {
NSDictionary* dict = DictionaryValueToNSDictionary(value);
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
} @catch (NSException* exception) {
args->ThrowError("Invalid userDefault data provided");
}
}
}
void SystemPreferences::SetUserDefault(const std::string& name,
const std::string& type,
mate::Arguments* args) {