mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 02:40:49 +00:00
TextEditor: Allow "TextEditor foo.txt" to create a new file
Attempting to open a non-existent file from the command line should not fail, it should just open a new text document with that name. Note that the file is not created until you actually save it.
This commit is contained in:
@@ -499,7 +499,7 @@ void TextEditorWidget::update_title()
|
||||
void TextEditorWidget::open_sesame(const String& path)
|
||||
{
|
||||
auto file = Core::File::construct(path);
|
||||
if (!file->open(Core::IODevice::ReadOnly)) {
|
||||
if (!file->open(Core::IODevice::ReadOnly) && file->error() != ENOENT) {
|
||||
GUI::MessageBox::show(String::format("Opening \"%s\" failed: %s", path.characters(), strerror(errno)), "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window());
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user