mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-03 21:10:30 +00:00
CrashReporter: Use the Core::Stream
friendly API, save_file()
This commit is contained in:
parent
6dd716adf2
commit
d3ce9cf8f6
Notes:
sideshowbarker
2024-07-17 03:11:22 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/d3ce9cf8f6 Pull-request: https://github.com/SerenityOS/serenity/pull/16368 Reviewed-by: https://github.com/linusg ✅ Reviewed-by: https://github.com/sin-ack ✅ Reviewed-by: https://github.com/timschumi
1 changed files with 7 additions and 5 deletions
|
@ -278,13 +278,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
save_backtrace_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv)));
|
||||
save_backtrace_button.on_click = [&](auto) {
|
||||
LexicalPath lexical_path(DeprecatedString::formatted("{}_{}_backtrace.txt", pid, app_name));
|
||||
auto file_or_error = FileSystemAccessClient::Client::the().try_save_file_deprecated(window, lexical_path.title(), lexical_path.extension());
|
||||
if (file_or_error.is_error())
|
||||
auto file_or_error = FileSystemAccessClient::Client::the().save_file(window, lexical_path.title(), lexical_path.extension());
|
||||
if (file_or_error.is_error()) {
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Communication failed with FileSystemAccessServer: {}.", file_or_error.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
auto file = file_or_error.value();
|
||||
if (!file->write(full_backtrace.to_deprecated_string()))
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
auto file = file_or_error.release_value();
|
||||
if (auto result = file->write(full_backtrace.to_byte_buffer()); result.is_error())
|
||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", result.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||
};
|
||||
save_backtrace_button.set_enabled(false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue