mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibCore: Make Core::File::open() return a Result<NNRP<File>, String>
It was impractical to return a RefPtr<File> since that left us no way to extract the error string. This is usually needed for the UI, so the old static open() got basically no use.
This commit is contained in:
@@ -993,12 +993,13 @@ void load_history()
|
||||
|
||||
void save_history()
|
||||
{
|
||||
auto history_file = Core::File::open(get_history_path(), Core::IODevice::WriteOnly, 0600);
|
||||
if (!history_file)
|
||||
auto file_or_error = Core::File::open(get_history_path(), Core::IODevice::WriteOnly, 0600);
|
||||
if (file_or_error.is_error())
|
||||
return;
|
||||
auto& file = *file_or_error.value();
|
||||
for (const auto& line : editor.history()) {
|
||||
history_file->write(line);
|
||||
history_file->write("\n");
|
||||
file.write(line);
|
||||
file.write("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user