diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-03-15 14:54:00 +0000 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-03-15 12:49:33 -0400 |
commit | 8672b380f6ae88754202c91f2075861c20231232 (patch) | |
tree | 7ed2686bf580b0bec72008ba3ad95aa4d97459a3 /Meta/Lagom | |
parent | 2d45e1fca53a11bf1e0bfa99e70cc8d4e6cf17dc (diff) | |
download | serenity-8672b380f6ae88754202c91f2075861c20231232.zip |
LibUnicode: Read emoji file title from LexicalPath directly
... rather than taking the whole file name, and then manually trimming
the extension off.
Diffstat (limited to 'Meta/Lagom')
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp index b9be27ce79..66b79d15d4 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp @@ -180,14 +180,12 @@ static ErrorOr<void> validate_emoji(StringView emoji_resource_path, EmojiData& e if (lexical_path.extension() != "png") continue; - auto basename = lexical_path.basename(); - if (!basename.starts_with("U+"sv)) - continue; - - basename = basename.substring_view(0, basename.length() - lexical_path.extension().length() - 1); + auto title = lexical_path.title(); + if (!title.starts_with("U+"sv)) + return IterationDecision::Continue; Vector<u32> code_points; - TRY(basename.for_each_split_view('_', SplitBehavior::Nothing, [&](auto segment) -> ErrorOr<void> { + TRY(title.for_each_split_view('_', SplitBehavior::Nothing, [&](auto segment) -> ErrorOr<void> { auto code_point = AK::StringUtils::convert_to_uint_from_hex<u32>(segment.substring_view(2)); VERIFY(code_point.has_value()); |