diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-27 15:45:56 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-27 15:45:56 -0800 |
| commit | c0ae9fee7e30cdd4898df22aecf5412b2d8f8ee6 (patch) | |
| tree | 460db03fec88a2a9ed55a5f55a1d8b732c20d299 /toolsrc/src/vcpkglib.cpp | |
| parent | 00737588cc6155776734c5a5261c9b08f9446eb4 (diff) | |
| download | vcpkg-c0ae9fee7e30cdd4898df22aecf5412b2d8f8ee6.tar.gz vcpkg-c0ae9fee7e30cdd4898df22aecf5412b2d8f8ee6.zip | |
Move some functions from vcpkglib.h to Paragraphs.h
Diffstat (limited to 'toolsrc/src/vcpkglib.cpp')
| -rw-r--r-- | toolsrc/src/vcpkglib.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp index d453f1dc9..2415372db 100644 --- a/toolsrc/src/vcpkglib.cpp +++ b/toolsrc/src/vcpkglib.cpp @@ -200,56 +200,4 @@ namespace vcpkg return installed_files; } - - expected<SourceParagraph> try_load_port(const fs::path& path) - { - try - { - auto pghs = Paragraphs::get_paragraphs(path / "CONTROL"); - Checks::check_exit(pghs.size() == 1, "Invalid control file at %s\\CONTROL", path.string()); - return SourceParagraph(pghs[0]); - } - catch (std::runtime_error const&) { } - - return std::errc::no_such_file_or_directory; - } - - expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec) - { - const fs::path path = paths.package_dir(spec) / "CONTROL"; - - auto control_contents_maybe = Files::read_contents(path); - if (auto control_contents = control_contents_maybe.get()) - { - std::vector<std::unordered_map<std::string, std::string>> pghs; - try - { - pghs = Paragraphs::parse_paragraphs(*control_contents); - } - catch (std::runtime_error) { } - Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", path.string()); - return BinaryParagraph(pghs[0]); - } - return control_contents_maybe.error_code(); - } - - std::vector<SourceParagraph> load_all_ports(const fs::path& ports_dir) - { - std::vector<SourceParagraph> output; - for (auto it = fs::directory_iterator(ports_dir); it != fs::directory_iterator(); ++it) - { - const fs::path& path = it->path(); - expected<SourceParagraph> source_paragraph = try_load_port(path); - if (auto srcpgh = source_paragraph.get()) - { - output.emplace_back(std::move(*srcpgh)); - } - else - { - Checks::exit_with_message("Error loading port from %s: %s", path.generic_string(), source_paragraph.error_code().message()); - } - } - - return output; - } } |
