Add method write() to Config.
This commit is contained in:
parent
8a0c69b1e8
commit
ed14492b46
|
@ -167,13 +167,8 @@ void Config::generate()
|
|||
newjson[_profile]["max_size"] = std::stoul(line);
|
||||
|
||||
_json = newjson;
|
||||
ofstream file{get_filename()};
|
||||
if (file.good())
|
||||
{
|
||||
file << newjson.toStyledString();
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Wrote config file.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Generated configuration.";
|
||||
write();
|
||||
}
|
||||
|
||||
string Config::get_access_token(const string &instance) const
|
||||
|
@ -242,4 +237,15 @@ void Config::parse()
|
|||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Read config: " << data;
|
||||
}
|
||||
|
||||
void Config::write() const
|
||||
{
|
||||
ofstream file{get_filename()};
|
||||
if (file.good())
|
||||
{
|
||||
file << _json.toStyledString();
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Wrote config file.";
|
||||
}
|
||||
} // namespace mastorss
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
|
||||
ProfileData data;
|
||||
|
||||
void write() const;
|
||||
|
||||
private:
|
||||
const string _profile;
|
||||
Json::Value _json;
|
||||
|
|
Loading…
Reference in New Issue
Block a user