mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
TextEditor: Show an error message when opening a file failed
This commit is contained in:
parent
71840c1bf4
commit
c03353e7ca
Notes:
sideshowbarker
2024-07-18 09:20:46 +09:00
Author: https://github.com/timmot Commit: https://github.com/SerenityOS/serenity/commit/c03353e7cae Pull-request: https://github.com/SerenityOS/serenity/pull/8626 Reviewed-by: https://github.com/gunnarbeutner
1 changed files with 4 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <LibCore/File.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibGUI/Menubar.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
|
||||
using namespace TextEditor;
|
||||
|
||||
|
@ -109,8 +110,10 @@ int main(int argc, char** argv)
|
|||
FileArgument parsed_argument(file_to_edit);
|
||||
auto file = Core::File::open(file_to_edit_full_path, Core::OpenMode::ReadOnly);
|
||||
|
||||
if (file.is_error())
|
||||
if (file.is_error()) {
|
||||
GUI::MessageBox::show_error(window, String::formatted("Opening \"{}\" failed: {}", file_to_edit_full_path, file.error()));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!text_widget.read_file_and_close(file.value()->leak_fd(), file_to_edit_full_path))
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue