mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibCore: Make Core::File::open() return OSError in case of failure
This commit is contained in:
parent
1474a537b6
commit
13f4890c38
8 changed files with 15 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -27,11 +27,11 @@
|
|||
|
||||
namespace Core {
|
||||
|
||||
Result<NonnullRefPtr<File>, String> File::open(String filename, OpenMode mode, mode_t permissions)
|
||||
Result<NonnullRefPtr<File>, OSError> File::open(String filename, OpenMode mode, mode_t permissions)
|
||||
{
|
||||
auto file = File::construct(move(filename));
|
||||
if (!file->open_impl(mode, permissions))
|
||||
return String(file->error_string());
|
||||
return OSError(file->error());
|
||||
return file;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue