mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-30 03:20:28 +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:
parent
b59f4632d5
commit
d127492f0e
Notes:
sideshowbarker
2024-07-19 05:49:46 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d127492f0e3
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue