From 8672b380f6ae88754202c91f2075861c20231232 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 15 Mar 2023 14:54:00 +0000 Subject: LibUnicode: Read emoji file title from LexicalPath directly ... rather than taking the whole file name, and then manually trimming the extension off. --- .../Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp | 10 ++++------ 1 file 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 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 code_points; - TRY(basename.for_each_split_view('_', SplitBehavior::Nothing, [&](auto segment) -> ErrorOr { + TRY(title.for_each_split_view('_', SplitBehavior::Nothing, [&](auto segment) -> ErrorOr { auto code_point = AK::StringUtils::convert_to_uint_from_hex(segment.substring_view(2)); VERIFY(code_point.has_value()); -- cgit v1.2.3