From 843e390c94cae55fdd4d411fc5c96f399af0f6f0 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 16 Dec 2016 16:20:27 -0800 Subject: Replace reading lines and ignoring empty lines with the new functions Namely: Files::read_all_lines(); Strings::trim_all_and_remove_whitespace_strings() --- toolsrc/src/vcpkg.cpp | 17 ++--------------- 1 file 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 vcpkg::get_installed_files(con { std::vector installed_files; - std::string line; - for (const std::unique_ptr& pgh : status_db) { if (pgh->state != install_state_t::installed) @@ -194,19 +192,8 @@ std::vector vcpkg::get_installed_files(con } const fs::path listfile_path = paths.listfile_path(pgh->package); - std::fstream listfile(listfile_path); - - std::vector 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 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 -- cgit v1.2.3