aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toolsrc/include/vcpkg/statusparagraph.h2
-rw-r--r--toolsrc/src/vcpkg/statusparagraphs.cpp2
-rw-r--r--toolsrc/src/vcpkg/vcpkglib.cpp4
3 files changed, 5 insertions, 3 deletions
diff --git a/toolsrc/include/vcpkg/statusparagraph.h b/toolsrc/include/vcpkg/statusparagraph.h
index ca84b1bb7..051acf95f 100644
--- a/toolsrc/include/vcpkg/statusparagraph.h
+++ b/toolsrc/include/vcpkg/statusparagraph.h
@@ -32,6 +32,8 @@ namespace vcpkg
StatusParagraph();
explicit StatusParagraph(std::unordered_map<std::string, std::string>&& fields);
+ bool is_installed() const { return want == Want::INSTALL && state == InstallState::INSTALLED; }
+
BinaryParagraph package;
Want want;
InstallState state;
diff --git a/toolsrc/src/vcpkg/statusparagraphs.cpp b/toolsrc/src/vcpkg/statusparagraphs.cpp
index d4afc0427..19919b76f 100644
--- a/toolsrc/src/vcpkg/statusparagraphs.cpp
+++ b/toolsrc/src/vcpkg/statusparagraphs.cpp
@@ -48,7 +48,7 @@ namespace vcpkg
const Triplet& triplet) const
{
const const_iterator it = find(name, triplet);
- if (it != end() && (*it)->want == Want::INSTALL && (*it)->state == InstallState::INSTALLED)
+ if (it != end() && (*it)->is_installed())
{
return it;
}
diff --git a/toolsrc/src/vcpkg/vcpkglib.cpp b/toolsrc/src/vcpkg/vcpkglib.cpp
index 5b2cec4d0..de6ffefed 100644
--- a/toolsrc/src/vcpkg/vcpkglib.cpp
+++ b/toolsrc/src/vcpkg/vcpkglib.cpp
@@ -173,7 +173,7 @@ namespace vcpkg
std::vector<StatusParagraph*> installed_packages;
for (auto&& pgh : status_db)
{
- if (pgh->state != InstallState::INSTALLED || pgh->want != Want::INSTALL) continue;
+ if (!pgh->is_installed()) continue;
installed_packages.push_back(pgh.get());
}
@@ -189,7 +189,7 @@ namespace vcpkg
for (const std::unique_ptr<StatusParagraph>& pgh : status_db)
{
- if (pgh->state != InstallState::INSTALLED || !pgh->package.feature.empty())
+ if (!pgh->is_installed() || !pgh->package.feature.empty())
{
continue;
}