diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-03-15 14:56:20 +0000 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-03-15 12:49:33 -0400 |
commit | 8a8ad81aa13ec25d20d78bf99f951055ef416597 (patch) | |
tree | 9ee3420c560cadc222ac1bdcf43788dc5f2a9dd1 /Meta/Lagom/Tools | |
parent | 8672b380f6ae88754202c91f2075861c20231232 (diff) | |
download | serenity-8a8ad81aa13ec25d20d78bf99f951055ef416597.zip |
LibUnicode: Migrate GenerateEmojiData to Directory::for_each_entry()
Diffstat (limited to 'Meta/Lagom/Tools')
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp index 66b79d15d4..09a3dab1c0 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp @@ -13,7 +13,6 @@ #include <AK/Types.h> #include <LibCore/ArgsParser.h> #include <LibCore/DeprecatedFile.h> -#include <LibCore/DirIterator.h> #include <LibCore/Directory.h> #include <LibUnicode/Emoji.h> @@ -171,14 +170,10 @@ static ErrorOr<void> parse_emoji_serenity_data(Core::BufferedFile& file, EmojiDa static ErrorOr<void> validate_emoji(StringView emoji_resource_path, EmojiData& emoji_data) { - Core::DirIterator iterator(emoji_resource_path, Core::DirIterator::SkipDots); - - while (iterator.has_next()) { - auto filename = iterator.next_path(); - - auto lexical_path = LexicalPath(filename); + TRY(Core::Directory::for_each_entry(emoji_resource_path, Core::DirIterator::SkipDots, [&](auto& entry, auto&) -> ErrorOr<IterationDecision> { + auto lexical_path = LexicalPath(entry.name); if (lexical_path.extension() != "png") - continue; + return IterationDecision::Continue; auto title = lexical_path.title(); if (!title.starts_with("U+"sv)) @@ -198,10 +193,12 @@ static ErrorOr<void> validate_emoji(StringView emoji_resource_path, EmojiData& e }); if (it == emoji_data.emojis.end()) { - warnln("\x1b[1;31mError!\x1b[0m Emoji data for \x1b[35m{}\x1b[0m not found. Please check emoji-test.txt and emoji-serenity.txt.", filename); + warnln("\x1b[1;31mError!\x1b[0m Emoji data for \x1b[35m{}\x1b[0m not found. Please check emoji-test.txt and emoji-serenity.txt.", entry.name); return Error::from_errno(ENOENT); } - } + + return IterationDecision::Continue; + })); return {}; } |