LibCore: Use ErrorOr<T> for Core::File::size()
This commit is contained in:
parent
4a2b718ba2
commit
fac2550143
Notes:
sideshowbarker
2024-07-18 01:23:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/fac25501436
2 changed files with 3 additions and 3 deletions
|
@ -153,11 +153,11 @@ bool File::exists(String const& filename)
|
|||
return stat(filename.characters(), &st) == 0;
|
||||
}
|
||||
|
||||
Result<size_t, OSError> File::size(String const& filename)
|
||||
ErrorOr<size_t> File::size(String const& filename)
|
||||
{
|
||||
struct stat st;
|
||||
if (stat(filename.characters(), &st) < 0)
|
||||
return OSError(errno);
|
||||
return Error::from_errno(errno);
|
||||
return st.st_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
static bool is_link(String const& filename);
|
||||
|
||||
static bool exists(String const& filename);
|
||||
static Result<size_t, OSError> size(String const& filename);
|
||||
static ErrorOr<size_t> size(String const& filename);
|
||||
static bool ensure_parent_directories(String const& path);
|
||||
static String current_working_directory();
|
||||
static String absolute_path(String const& path);
|
||||
|
|
Loading…
Add table
Reference in a new issue