1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:07:34 +00:00

PixelPaint: Use FileSystemAccessClient::try_* APIs

This commit is contained in:
Mustafa Quraish 2022-01-16 04:30:06 -05:00 committed by Andreas Kling
parent aae96af812
commit 1c3e93c6e0
11 changed files with 59 additions and 105 deletions

View file

@ -71,13 +71,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->show();
if (image_file) {
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window->window_id(), image_file);
if (response.error != 0) {
if (response.error != -1)
GUI::MessageBox::show_error(window, String::formatted("Opening \"{}\" failed: {}", *response.chosen_file, strerror(response.error)));
auto response = FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window, image_file);
if (response.is_error())
return 1;
}
main_widget->open_image_fd(*response.fd, *response.chosen_file);
main_widget->open_image(response.value());
} else {
main_widget->create_default_image();
}