1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 20:57:44 +00:00

Applications: Improve FSAC error message handling

Fixes apps showing redundant error messages and terminating
unnecessarily on failed file requests. It's nicer to drop the
user off at the equivalent of a default document on failure if
possible.

Also fixes TextEditor not showing response errors for missing files
in the recently opened list.
This commit is contained in:
thankyouverycool 2023-05-18 08:50:38 -04:00 committed by Andreas Kling
parent fef594708e
commit 444470b238
5 changed files with 17 additions and 19 deletions

View file

@ -55,9 +55,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (arguments.argc > 1) {
// FIXME: Using `try_request_file_read_only_approved` doesn't work here since the file stored in the editor is only readable.
auto response = FileSystemAccessClient::Client::the().request_file(window, arguments.strings[1], Core::File::OpenMode::ReadWrite);
if (response.is_error())
return 1;
hex_editor_widget->open_file(response.value().filename(), response.value().release_stream());
if (!response.is_error())
hex_editor_widget->open_file(response.value().filename(), response.value().release_stream());
}
return app->exec();