summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTimothy <timmot@users.noreply.github.com>2021-07-11 09:39:00 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-11 14:11:53 +0200
commitc03353e7cae00a0757a7ff50a2d8e89c025fc5c8 (patch)
tree8f55a081fc850a863d0fb0020ae04f15fe71552e /Userland
parent71840c1bf41c972a75a4155dc0440d9a5ca0a263 (diff)
downloadserenity-c03353e7cae00a0757a7ff50a2d8e89c025fc5c8.zip
TextEditor: Show an error message when opening a file failed
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/TextEditor/main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Applications/TextEditor/main.cpp b/Userland/Applications/TextEditor/main.cpp
index 9ac38cbffe..9c4eef23e2 100644
--- a/Userland/Applications/TextEditor/main.cpp
+++ b/Userland/Applications/TextEditor/main.cpp
@@ -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;