mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
LibUnicode: Migrate GenerateEmojiData to Directory::for_each_entry()
This commit is contained in:
parent
8672b380f6
commit
8a8ad81aa1
1 changed files with 7 additions and 10 deletions
|
@ -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 {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue