|
@@ -175,11 +175,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
});
|
|
|
|
|
|
TRY(file_menu->try_add_action(GUI::CommonActions::make_open_action([&](auto&) {
|
|
|
- Optional<String> open_path = GUI::FilePicker::get_open_filepath(window);
|
|
|
-
|
|
|
- if (!open_path.has_value())
|
|
|
- return;
|
|
|
-
|
|
|
if (window->is_modified()) {
|
|
|
auto result = GUI::MessageBox::ask_about_unsaved_changes(window, file_path, editor->document().undo_stack().last_unmodified_timestamp());
|
|
|
if (result == GUI::MessageBox::ExecYes)
|
|
@@ -188,6 +183,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ Optional<String> open_path = GUI::FilePicker::get_open_filepath(window);
|
|
|
+ if (!open_path.has_value())
|
|
|
+ return;
|
|
|
+
|
|
|
auto file = Core::File::construct(open_path.value());
|
|
|
if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) {
|
|
|
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: {}", open_path.value(), strerror(errno)), "Error", GUI::MessageBox::Type::Error);
|