1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibCore+Everywhere: Return ErrorOr from ConfigFile::sync()

Currently this method always succeeds, but that won't be true once we
switch to the Core::Stream API. :^)

Some of these places would ideally show an error message to the user,
since failure to save a file is significant, but let's not get
distracted right now.
This commit is contained in:
Sam Atkins 2022-02-06 14:26:33 +00:00 committed by Tim Flynn
parent b90dc408bd
commit cd0ffe5460
10 changed files with 39 additions and 24 deletions

View file

@ -76,7 +76,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto keymaps = String::join(',', mappings_vector);
mapper_config->write_entry("Mapping", "Keymaps", keymaps);
mapper_config->sync();
TRY(mapper_config->sync());
rc = set_keymap(mappings_vector.first());
if (rc != 0) {
return rc;
@ -90,7 +90,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (keymaps_vector.is_empty()) {
warnln("No keymaps configured - writing default configurations (en-us)");
mapper_config->write_entry("Mapping", "Keymaps", "en-us");
mapper_config->sync();
TRY(mapper_config->sync());
keymaps_vector.append("en-us");
}