summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-03-15 15:38:20 +0000
committerTim Flynn <trflynn89@pm.me>2023-03-15 12:49:33 -0400
commit414cafa7f880e0632e8ad96c89c5b030a74a6c65 (patch)
treefd09f55b3cef1f49a3b9723439951c645bb1071b /Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp
parent8a8ad81aa13ec25d20d78bf99f951055ef416597 (diff)
downloadserenity-414cafa7f880e0632e8ad96c89c5b030a74a6c65.zip
LibLocale: Migrate code generators to Directory::for_each_entry()
Diffstat (limited to 'Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp')
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp
index ff13b336fa..2b24c31710 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp
@@ -15,6 +15,7 @@
#include <AK/Variant.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
+#include <LibCore/Directory.h>
#include <LibLocale/PluralRules.h>
static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier)
@@ -393,8 +394,6 @@ static ErrorOr<void> parse_plural_ranges(DeprecatedString core_supplemental_path
static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedString locale_names_path, CLDR& cldr)
{
- auto identity_iterator = TRY(path_to_dir_iterator(move(locale_names_path)));
-
LexicalPath core_supplemental_path(move(core_path));
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
@@ -412,12 +411,13 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
return builder.to_deprecated_string();
};
- while (identity_iterator.has_next()) {
- auto locale_path = TRY(next_path_from_dir_iterator(identity_iterator));
+ TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/main", locale_names_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
+ auto locale_path = LexicalPath::join(directory.path().string(), entry.name).string();
auto language = TRY(remove_variants_from_path(locale_path));
cldr.locales.ensure(language);
- }
+ return IterationDecision::Continue;
+ }));
TRY(parse_plural_rules(core_supplemental_path.string(), "plurals.json"sv, cldr));
TRY(parse_plural_rules(core_supplemental_path.string(), "ordinals.json"sv, cldr));