diff options
| -rw-r--r-- | toolsrc/include/vcpkg_paths.h | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg.cpp | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_paths.cpp | 5 |
3 files changed, 11 insertions, 9 deletions
diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index 046b6836c..8276242e9 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -2,6 +2,7 @@ #include <filesystem> #include "expected.h" #include "package_spec.h" +#include "BinaryParagraph.h" namespace vcpkg { @@ -13,6 +14,7 @@ namespace vcpkg fs::path package_dir(const package_spec& spec) const; fs::path port_dir(const package_spec& spec) const; + fs::path listfile_path(const BinaryParagraph& pgh) const; bool is_valid_triplet(const triplet& t) const; fs::path root; diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index d9956e789..729a0c8d5 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -123,11 +123,6 @@ StatusParagraphs vcpkg::database_load_check(const vcpkg_paths& paths) return current_status_db; } -static fs::path listfile_path(const vcpkg_paths& paths, const BinaryParagraph& pgh) -{ - return paths.vcpkg_dir_info / (pgh.fullstem() + ".list"); -} - static std::string get_fullpkgname_from_listfile(const fs::path& path) { auto ret = path.stem().generic_u8string(); @@ -149,7 +144,7 @@ static void write_update(const vcpkg_paths& paths, const StatusParagraph& p) static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryParagraph& bpgh) { - std::fstream listfile(listfile_path(paths, bpgh), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc); + std::fstream listfile(paths.listfile_path(bpgh), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc); auto package_prefix_path = paths.package_dir(bpgh.spec); auto prefix_length = package_prefix_path.native().size(); @@ -308,7 +303,7 @@ void vcpkg::deinstall_package(const vcpkg_paths& paths, const package_spec& spec pkg.state = install_state_t::half_installed; write_update(paths, pkg); - std::fstream listfile(listfile_path(paths, pkg.package), std::ios_base::in | std::ios_base::binary); + std::fstream listfile(paths.listfile_path(pkg.package), std::ios_base::in | std::ios_base::binary); if (listfile) { std::vector<fs::path> dirs_touched; @@ -367,7 +362,7 @@ void vcpkg::deinstall_package(const vcpkg_paths& paths, const package_spec& spec } listfile.close(); - fs::remove(listfile_path(paths, pkg.package)); + fs::remove(paths.listfile_path(pkg.package)); } pkg.state = install_state_t::not_installed; @@ -384,7 +379,7 @@ void vcpkg::search_file(const vcpkg_paths& paths, const std::string& file_substr if (pgh->state != install_state_t::installed) continue; - std::fstream listfile(listfile_path(paths, pgh->package)); + std::fstream listfile(paths.listfile_path(pgh->package)); while (std::getline(listfile, line)) { if (line.empty()) diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp index 1f9eb0bc5..28ab22ec3 100644 --- a/toolsrc/src/vcpkg_paths.cpp +++ b/toolsrc/src/vcpkg_paths.cpp @@ -55,6 +55,11 @@ namespace vcpkg return this->ports / spec.name(); } + fs::path vcpkg_paths::listfile_path(const BinaryParagraph& pgh) const + { + return this->vcpkg_dir_info / (pgh.fullstem() + ".list"); + } + bool vcpkg_paths::is_valid_triplet(const triplet& t) const { auto it = fs::directory_iterator(this->triplets); |
