mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-04 09:14:21 +03:00
23aec16e8b
`Core::Directory::for_each_entry()` takes a callback which is passed the DirectoryEntry and the parent Directory. It returns any error from creating the iterator, iterating the entries, or returned from the callback. As a simple example, this: ```c++ Core::DirIterator piece_set_iterator { "/res/icons/chess/sets/", Core::DirIterator::SkipParentAndBaseDir }; while (piece_set_iterator.has_next()) m_piece_sets.append(piece_set_iterator.next_path()); ``` becomes this: ```c++ TRY(Core::Directory::for_each_entry("/res/icons/chess/sets/"sv, Core::DirIterator::SkipParentAndBaseDir, [&](auto const& entry, auto&) -> ErrorOr<IterationDecision> { TRY(m_piece_sets.try_append(entry.name)); return IterationDecision::Continue; })); ``` |
||
---|---|---|
.. | ||
Applets | ||
Applications | ||
BuggieBox | ||
Demos | ||
DevTools | ||
DynamicLoader | ||
Games | ||
Libraries | ||
Services | ||
Shell | ||
Utilities | ||
CMakeLists.txt |