mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:37:46 +00:00
HexEditor: Use FileSystemAccessClient::try_* APIs
This commit is contained in:
parent
0c98e553e8
commit
aae96af812
5 changed files with 21 additions and 58 deletions
|
@ -48,15 +48,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
if (arguments.argc > 1) {
|
||||
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window->window_id(), arguments.strings[1]);
|
||||
|
||||
if (response.error != 0) {
|
||||
if (response.error != -1)
|
||||
GUI::MessageBox::show_error(window, String::formatted("Opening \"{}\" failed: {}", *response.chosen_file, strerror(response.error)));
|
||||
// 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().try_request_file(window, arguments.strings[1], Core::OpenMode::ReadWrite);
|
||||
if (response.is_error())
|
||||
return 1;
|
||||
}
|
||||
|
||||
hex_editor_widget->open_file(*response.fd, *response.chosen_file);
|
||||
hex_editor_widget->open_file(response.value());
|
||||
}
|
||||
|
||||
return app->exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue