mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:17:35 +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 <AK/Types.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/DeprecatedFile.h>
|
#include <LibCore/DeprecatedFile.h>
|
||||||
#include <LibCore/DirIterator.h>
|
|
||||||
#include <LibCore/Directory.h>
|
#include <LibCore/Directory.h>
|
||||||
#include <LibUnicode/Emoji.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)
|
static ErrorOr<void> validate_emoji(StringView emoji_resource_path, EmojiData& emoji_data)
|
||||||
{
|
{
|
||||||
Core::DirIterator iterator(emoji_resource_path, Core::DirIterator::SkipDots);
|
TRY(Core::Directory::for_each_entry(emoji_resource_path, Core::DirIterator::SkipDots, [&](auto& entry, auto&) -> ErrorOr<IterationDecision> {
|
||||||
|
auto lexical_path = LexicalPath(entry.name);
|
||||||
while (iterator.has_next()) {
|
|
||||||
auto filename = iterator.next_path();
|
|
||||||
|
|
||||||
auto lexical_path = LexicalPath(filename);
|
|
||||||
if (lexical_path.extension() != "png")
|
if (lexical_path.extension() != "png")
|
||||||
continue;
|
return IterationDecision::Continue;
|
||||||
|
|
||||||
auto title = lexical_path.title();
|
auto title = lexical_path.title();
|
||||||
if (!title.starts_with("U+"sv))
|
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()) {
|
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 Error::from_errno(ENOENT);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return IterationDecision::Continue;
|
||||||
|
}));
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue