mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 08:13:03 +08:00
[owns command] Use get_installed_files()
This commit is contained in:
parent
7c2abc755f
commit
4d298be260
@ -1,30 +1,21 @@
|
|||||||
#include "vcpkg_Commands.h"
|
#include "vcpkg_Commands.h"
|
||||||
#include "vcpkg_System.h"
|
#include "vcpkg_System.h"
|
||||||
#include "vcpkg.h"
|
#include "vcpkg.h"
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
namespace vcpkg
|
namespace vcpkg
|
||||||
{
|
{
|
||||||
static void search_file(const vcpkg_paths& paths, const std::string& file_substr, const StatusParagraphs& status_db)
|
static void search_file(const vcpkg_paths& paths, const std::string& file_substr, const StatusParagraphs& status_db)
|
||||||
{
|
{
|
||||||
std::string line;
|
const std::vector<StatusParagraph_and_associated_files> installed_files = get_installed_files(paths, status_db);
|
||||||
|
for (const StatusParagraph_and_associated_files& pgh_and_file : installed_files)
|
||||||
|
{
|
||||||
|
const StatusParagraph& pgh = pgh_and_file.pgh;
|
||||||
|
|
||||||
for (auto&& pgh : status_db)
|
for (const std::string& file : pgh_and_file.files)
|
||||||
{
|
{
|
||||||
if (pgh->state != install_state_t::installed)
|
if (file.find(file_substr) != std::string::npos)
|
||||||
continue;
|
|
||||||
|
|
||||||
std::fstream listfile(paths.listfile_path(pgh->package));
|
|
||||||
while (std::getline(listfile, line))
|
|
||||||
{
|
{
|
||||||
if (line.empty())
|
System::println("%s: %s", pgh.package.displayname(), file);
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.find(file_substr) != std::string::npos)
|
|
||||||
{
|
|
||||||
System::println("%s: %s", pgh->package.displayname(), line);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user