diff options
Diffstat (limited to 'toolsrc/src/Paragraphs.cpp')
| -rw-r--r-- | toolsrc/src/Paragraphs.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index 70d3db2b3..13103d1f8 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -168,7 +168,7 @@ namespace vcpkg::Paragraphs return parse_single_paragraph(*spgh); } - return contents.error_code(); + return contents.error(); } Expected<std::vector<std::unordered_map<std::string, std::string>>> get_paragraphs(const Files::Filesystem& fs, @@ -180,7 +180,7 @@ namespace vcpkg::Paragraphs return parse_paragraphs(*spgh); } - return contents.error_code(); + return contents.error(); } Expected<std::unordered_map<std::string, std::string>> parse_single_paragraph(const std::string& str) @@ -201,15 +201,16 @@ namespace vcpkg::Paragraphs return Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); } - Expected<SourceParagraph> try_load_port(const Files::Filesystem& fs, const fs::path& path) + ExpectedT<SourceParagraph, ParseControlErrorInfo> try_load_port(const Files::Filesystem& fs, const fs::path& path) { + ParseControlErrorInfo error_info; Expected<std::unordered_map<std::string, std::string>> pghs = get_single_paragraph(fs, path / "CONTROL"); if (auto p = pghs.get()) { - return SourceParagraph(*p); + return SourceParagraph::parse_control_file(*p); } - - return pghs.error_code(); + error_info.error = pghs.error(); + return error_info; } Expected<BinaryParagraph> try_load_cached_package(const VcpkgPaths& paths, const PackageSpec& spec) @@ -222,20 +223,26 @@ namespace vcpkg::Paragraphs return BinaryParagraph(*p); } - return pghs.error_code(); + return pghs.error(); } std::vector<SourceParagraph> load_all_ports(const Files::Filesystem& fs, const fs::path& ports_dir) { std::vector<SourceParagraph> output; + std::vector<ParseControlErrorInfo> port_errors; for (auto&& path : fs.get_files_non_recursive(ports_dir)) { - Expected<SourceParagraph> source_paragraph = try_load_port(fs, path); + ExpectedT<SourceParagraph, ParseControlErrorInfo> source_paragraph = try_load_port(fs, path); if (auto srcpgh = source_paragraph.get()) { output.emplace_back(std::move(*srcpgh)); } + else + { + port_errors.emplace_back(source_paragraph.error()); + } } + print_error_message(port_errors); return output; } |
