mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
PartitionEditor: Show better error when can't find partition table
This commit is contained in:
parent
91cdda7763
commit
c566ef2a9d
Notes:
sideshowbarker
2024-07-17 02:35:27 +09:00
Author: https://github.com/hughdavenport Commit: https://github.com/SerenityOS/serenity/commit/c566ef2a9d Pull-request: https://github.com/SerenityOS/serenity/pull/22604 Reviewed-by: https://github.com/supercomputer7
1 changed files with 7 additions and 1 deletions
|
@ -64,7 +64,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto device_paths = get_device_paths();
|
||||
|
||||
auto partition_model = PartitionEditor::PartitionModel::create();
|
||||
TRY(partition_model->set_device_path(device_paths.first()));
|
||||
auto found_it = device_paths.find_if([&](auto const& path) {
|
||||
auto result = partition_model->set_device_path(path);
|
||||
return !result.is_error();
|
||||
});
|
||||
// FIXME: Give the user some way to create a partition table
|
||||
if (found_it == device_paths.end())
|
||||
GUI::MessageBox::show_error(window, ByteString::formatted("No partition table found on any valid block device"));
|
||||
|
||||
auto& device_combobox = *widget->find_descendant_of_type_named<GUI::ComboBox>("device_combobox");
|
||||
device_combobox.set_model(GUI::ItemListModel<ByteString>::create(device_paths));
|
||||
|
|
Loading…
Reference in a new issue