mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +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:
parent
a98ae8f357
commit
774f328783
17 changed files with 44 additions and 46 deletions
|
@ -348,12 +348,8 @@ inline ErrorOr<Core::DirIterator> path_to_dir_iterator(DeprecatedString path, St
|
|||
lexical_path = lexical_path.append(subpath);
|
||||
|
||||
Core::DirIterator iterator(lexical_path.string(), Core::DirIterator::SkipParentAndBaseDir);
|
||||
if (iterator.has_error()) {
|
||||
// FIXME: Make Core::DirIterator return a StringView for its error
|
||||
// string.
|
||||
auto const* error_string_ptr = iterator.error_string();
|
||||
return Error::from_string_view({ error_string_ptr, strlen(error_string_ptr) });
|
||||
}
|
||||
if (iterator.has_error())
|
||||
return iterator.error();
|
||||
|
||||
return iterator;
|
||||
}
|
||||
|
@ -361,12 +357,8 @@ inline ErrorOr<Core::DirIterator> path_to_dir_iterator(DeprecatedString path, St
|
|||
inline ErrorOr<DeprecatedString> next_path_from_dir_iterator(Core::DirIterator& iterator)
|
||||
{
|
||||
auto next_path = iterator.next_full_path();
|
||||
if (iterator.has_error()) {
|
||||
// FIXME: Make Core::DirIterator return a StringView for its error
|
||||
// string.
|
||||
auto const* error_string_ptr = iterator.error_string();
|
||||
return Error::from_string_view({ error_string_ptr, strlen(error_string_ptr) });
|
||||
}
|
||||
if (iterator.has_error())
|
||||
return iterator.error();
|
||||
|
||||
return next_path;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue