mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +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:
@@ -61,7 +61,7 @@ ConfigFile::ConfigFile(String const&, NonnullRefPtr<File> open_file)
|
||||
|
||||
ConfigFile::~ConfigFile()
|
||||
{
|
||||
sync();
|
||||
MUST(sync());
|
||||
}
|
||||
|
||||
void ConfigFile::reparse()
|
||||
@@ -168,10 +168,10 @@ void ConfigFile::write_color_entry(String const& group, String const& key, Color
|
||||
write_entry(group, key, String::formatted("{},{},{},{}", value.red(), value.green(), value.blue(), value.alpha()));
|
||||
}
|
||||
|
||||
bool ConfigFile::sync()
|
||||
ErrorOr<void> ConfigFile::sync()
|
||||
{
|
||||
if (!m_dirty)
|
||||
return true;
|
||||
return {};
|
||||
|
||||
m_file->truncate(0);
|
||||
m_file->seek(0);
|
||||
@@ -184,7 +184,7 @@ bool ConfigFile::sync()
|
||||
}
|
||||
|
||||
m_dirty = false;
|
||||
return true;
|
||||
return {};
|
||||
}
|
||||
|
||||
void ConfigFile::dump() const
|
||||
|
||||
Reference in New Issue
Block a user