update ConfigIni::Save

This commit is contained in:
Nomango 2020-05-31 22:10:49 +08:00
parent a62f1f4d2d
commit 7f902e3343
1 changed files with 10 additions and 6 deletions

View File

@ -158,6 +158,9 @@ bool ConfigIni::Save(std::ostream& os)
std::sort(keys.begin(), keys.end()); std::sort(keys.begin(), keys.end());
// Output to ini // Output to ini
std::ostream::sentry ok(os);
if (ok)
{
for (const auto& key : keys) for (const auto& key : keys)
{ {
os << '[' << key << ']' << std::endl; os << '[' << key << ']' << std::endl;
@ -167,7 +170,8 @@ bool ConfigIni::Save(std::ostream& os)
} }
os << std::endl; os << std::endl;
} }
return false; }
return !os.fail();
} }
ConfigIni::SectionMap ConfigIni::GetSectionMap() const ConfigIni::SectionMap ConfigIni::GetSectionMap() const