aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2016-12-16 16:20:27 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2016-12-16 16:20:27 -0800
commit843e390c94cae55fdd4d411fc5c96f399af0f6f0 (patch)
tree0d9701f142c8bd4ccba2728e3461980bdc0d4a2b /toolsrc/src
parenta5c3fddfe7bc4f765a0efdd9b109709f2fb4ae9c (diff)
downloadvcpkg-843e390c94cae55fdd4d411fc5c96f399af0f6f0.tar.gz
vcpkg-843e390c94cae55fdd4d411fc5c96f399af0f6f0.zip
Replace reading lines and ignoring empty lines with the new functions
Namely: Files::read_all_lines(); Strings::trim_all_and_remove_whitespace_strings()
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/vcpkg.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index 8d01cb267..bf9dbd6ab 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -184,8 +184,6 @@ std::vector<StatusParagraph_and_associated_files> vcpkg::get_installed_files(con
{
std::vector<StatusParagraph_and_associated_files> installed_files;
- std::string line;
-
for (const std::unique_ptr<StatusParagraph>& pgh : status_db)
{
if (pgh->state != install_state_t::installed)
@@ -194,19 +192,8 @@ std::vector<StatusParagraph_and_associated_files> vcpkg::get_installed_files(con
}
const fs::path listfile_path = paths.listfile_path(pgh->package);
- std::fstream listfile(listfile_path);
-
- std::vector<std::string> installed_files_of_current_pgh;
- while (std::getline(listfile, line))
- {
- if (line.empty())
- {
- continue;
- }
-
- installed_files_of_current_pgh.push_back(line);
- }
- listfile.close();
+ std::vector<std::string> installed_files_of_current_pgh = Files::read_all_lines(listfile_path).get_or_throw();
+ Strings::trim_all_and_remove_whitespace_strings(&installed_files_of_current_pgh);
upgrade_to_slash_terminated_sorted_format(&installed_files_of_current_pgh, listfile_path);
// Remove the directories