From a33a490d48c2cd7cf8037bf2732408770a5b76c8 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sat, 7 Jan 2023 11:31:47 -0500 Subject: [PATCH] Magnifier: Port to `Core::Stream` --- Userland/Applications/Magnifier/main.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp index cf949eab88..9178f8373e 100644 --- a/Userland/Applications/Magnifier/main.cpp +++ b/Userland/Applications/Magnifier/main.cpp @@ -67,17 +67,15 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(file_menu->try_add_action(GUI::CommonActions::make_save_as_action([&](auto&) { AK::DeprecatedString filename = "file for saving"; auto do_save = [&]() -> ErrorOr { - auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window, "Capture", "png"); + auto response = FileSystemAccessClient::Client::the().save_file(window, "Capture", "png"); if (response.is_error()) return {}; - auto file = response.release_value(); - auto path = AK::LexicalPath(file->filename()); + auto file = response.value().release_stream(); + auto path = AK::LexicalPath(response.value().filename().to_deprecated_string()); filename = path.basename(); auto encoded = TRY(dump_bitmap(magnifier->current_bitmap(), path.extension())); - if (!file->write(encoded.data(), encoded.size())) { - return Error::from_errno(file->error()); - } + TRY(file->write(encoded)); return {}; };