Skip to content

Commit

Permalink
Fix export manifest with multiple locales
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft committed Jun 20, 2024
1 parent 38aac87 commit d2eae39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/AppInstallerCLITests/YamlManifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,18 @@ TEST_CASE("WriteV1_7SingletonManifestAndVerifyContents", "[ManifestCreation]")
VerifyV1ManifestContent(generatedMultiFileManifest, false, ManifestVer{ s_ManifestVersionV1_7 }, true);
}

TEST_CASE("WriteManifestWithMultipleLocale", "[ManifestCreation]")
{
Manifest multiLocaleManifest = YamlParser::CreateFromPath(TestDataFile("Manifest-Good-MultiLocale.yaml"));
TempDirectory exportedDirectory{ "exported" };
std::filesystem::path generatedManifestPath = exportedDirectory.GetPath() / "testManifestWithMultipleLocale.yaml";
YamlWriter::OutputYamlFile(multiLocaleManifest, multiLocaleManifest.Installers[0], generatedManifestPath);

REQUIRE(std::filesystem::exists(generatedManifestPath));
Manifest generatedManifest = YamlParser::CreateFromPath(generatedManifestPath);
REQUIRE(generatedManifest.Localizations.size() == 2);
}

YamlManifestInfo CreateYamlManifestInfo(std::string testDataFile)
{
YamlManifestInfo result;
Expand Down
10 changes: 5 additions & 5 deletions src/AppInstallerCommonCore/Manifest/YamlWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,14 +610,14 @@ namespace AppInstaller::Manifest::YamlWriter
{
out << YAML::Key << Localization;
out << YAML::BeginSeq;
out << YAML::BeginMap;

for (const auto& localization : localizations)
{
ProcessLocaleFields(out, localization);
{
out << YAML::BeginMap;
ProcessLocaleFields(out, localization);
out << YAML::EndMap;
}

out << YAML::EndMap;
out << YAML::EndSeq;
}
}
Expand Down Expand Up @@ -669,4 +669,4 @@ namespace AppInstaller::Manifest::YamlWriter
emitter.Emit(outFileStream);
outFileStream.close();
}
}
}

0 comments on commit d2eae39

Please sign in to comment.