mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-24 07:53:41 +03:00
create_buffer_from file return nullptr on file not found instead of throwing
This commit is contained in:
parent
4be6882bd5
commit
6ff6058ceb
@ -216,12 +216,8 @@ private:
|
||||
|
||||
Buffer* open_or_create(const String& filename, Context& context)
|
||||
{
|
||||
Buffer* buffer = NULL;
|
||||
try
|
||||
{
|
||||
buffer = create_buffer_from_file(filename);
|
||||
}
|
||||
catch (file_not_found& what)
|
||||
Buffer* buffer = create_buffer_from_file(filename);
|
||||
if (not buffer)
|
||||
{
|
||||
context.print_status("new file " + filename);
|
||||
buffer = new Buffer(filename, Buffer::Type::NewFile);
|
||||
|
@ -76,7 +76,7 @@ Buffer* create_buffer_from_file(const String& filename)
|
||||
if (fd == -1)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
throw file_not_found(filename);
|
||||
return nullptr;
|
||||
|
||||
throw file_access_error(filename, strerror(errno));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user