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:
parent
d5828dbecb
commit
2e1a01a499
1 changed files with 5 additions and 0 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue