mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
ImageViewer: Migrate to Directory::for_each_entry()
This commit is contained in:
parent
c325a656ec
commit
8f3c77a5a3
Notes:
sideshowbarker
2024-07-17 05:02:42 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/8f3c77a5a3 Pull-request: https://github.com/SerenityOS/serenity/pull/17694
1 changed files with 8 additions and 8 deletions
|
@ -12,7 +12,7 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibCore/Timer.h>
|
||||
|
@ -82,13 +82,13 @@ Vector<DeprecatedString> ViewWidget::load_files_from_directory(DeprecatedString
|
|||
Vector<DeprecatedString> files_in_directory;
|
||||
|
||||
auto current_dir = LexicalPath(path).parent().string();
|
||||
Core::DirIterator iterator(current_dir, Core::DirIterator::Flags::SkipDots);
|
||||
while (iterator.has_next()) {
|
||||
DeprecatedString file = iterator.next_full_path();
|
||||
if (!Gfx::Bitmap::is_path_a_supported_image_format(file))
|
||||
continue;
|
||||
files_in_directory.append(file);
|
||||
}
|
||||
// FIXME: Propagate errors
|
||||
(void)Core::Directory::for_each_entry(current_dir, Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> {
|
||||
auto full_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
||||
if (Gfx::Bitmap::is_path_a_supported_image_format(full_path))
|
||||
files_in_directory.append(full_path);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return files_in_directory;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue