1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +00:00

TextEditor: Don't allow opening directories

Previously it was possible to open a directory in the TextEditor
application. Like device files, these are now rejected with an error
message.
This commit is contained in:
sinmineryt 2021-06-13 13:38:07 +02:00 committed by GitHub
parent d5828dbecb
commit 2e1a01a499
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -653,6 +653,11 @@ bool MainWidget::open_file(const String& path)
return false;
}
if (file->is_directory()) {
GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open directories", path), "Error", GUI::MessageBox::Type::Error);
return false;
}
m_editor->set_text(file->read_all());
set_path(LexicalPath(path));