diff --git a/src/config.cpp b/src/config.cpp index 6eb25d9..f089161 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -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 diff --git a/src/config.hpp b/src/config.hpp index eee785f..b378cf7 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -68,6 +68,8 @@ public: ProfileData data; + void write() const; + private: const string _profile; Json::Value _json;