Overwrite changelog only when modified

This commit is contained in:
Matthew Howle 2020-07-08 19:07:56 -04:00
parent 43bca1f878
commit 80b5d41eb6

View File

@ -2331,6 +2331,22 @@ void Downloader::saveChangelog(const std::string& changelog, const std::string&
} }
} }
// Check if changelog matches current changelog
if (boost::filesystem::exists(filepath))
{
std::ifstream ifs(filepath);
if (ifs)
{
std::string current_changelog((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
ifs.close();
if (changelog == current_changelog)
{
std::cout << "Changelog unchanged. Skipping: " << filepath << std::endl;
return;
}
}
}
std::ofstream ofs(filepath); std::ofstream ofs(filepath);
if (ofs) if (ofs)
{ {