1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 15:27:34 +00:00

LibCore+Everywhere: Return an Error from DirIterator::error()

This also removes DirIterator::error_string(), since the same strerror()
string will be included when you print the Error itself. Except in `ls`
which is still using fprintf() for now.
This commit is contained in:
Sam Atkins 2023-03-01 15:55:15 +00:00 committed by Andreas Kling
parent a98ae8f357
commit 774f328783
17 changed files with 44 additions and 46 deletions

View file

@ -28,9 +28,8 @@ public:
DirIterator(DirIterator&&);
DirIterator(DirIterator const&) = delete;
bool has_error() const { return m_error != 0; }
int error() const { return m_error; }
char const* error_string() const { return strerror(m_error); }
bool has_error() const { return m_error.has_value(); }
Error error() const { return Error::copy(m_error.value()); }
bool has_next();
Optional<DirectoryEntry> next();
DeprecatedString next_path();
@ -39,7 +38,7 @@ public:
private:
DIR* m_dir = nullptr;
int m_error = 0;
Optional<Error> m_error;
Optional<DirectoryEntry> m_next;
DeprecatedString m_path;
int m_flags;