Use Files::write_all_lines()

This commit is contained in:
Alexander Karatarakis 2016-12-15 18:24:06 -08:00
parent e4548a8cf4
commit 15ca6919ad
2 changed files with 2 additions and 13 deletions

View File

@ -132,12 +132,7 @@ namespace vcpkg
System::println(System::color::error, "failed: %s: cannot handle file type", it->path().u8string());
}
std::fstream listfile(paths.listfile_path(bpgh), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
for (const std::string& line : output)
{
listfile << line << "\n";
}
listfile.close();
Files::write_all_lines(paths.listfile_path(bpgh), output);
}
static void remove_first_n_chars(std::vector<std::string>* strings, const size_t n)

View File

@ -175,13 +175,7 @@ static void upgrade_to_slash_terminated_sorted_format(std::vector<std::string>*
#if 0
// Replace the listfile on disk
const fs::path updated_listfile_path = listfile_path.generic_string() + "_updated";
std::fstream output(updated_listfile_path, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
for (const std::string& line : *lines)
{
output << line << "\n";
}
output.close();
Files::write_all_lines(updated_listfile_path, *lines);
fs::rename(updated_listfile_path, listfile_path);
#endif
}