diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bc486f..2f7a107 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (mastobotmon - VERSION 0.3.6 + VERSION 0.3.7 LANGUAGES CXX) include(GNUInstallDirs) diff --git a/src/config.cpp b/src/config.cpp index 9262334..4987cff 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -41,9 +41,7 @@ const bool read_config() json << file.rdbuf(); file.close(); - Json::Reader reader; - - if (!reader.parse(json, config)) + if (json >> config) { cerr << "ERROR: couldn't parse config file. Are you sure the JSON is well-formed?\n"; return false; @@ -148,13 +146,11 @@ const bool add_account() const bool write_config() { - Json::StyledWriter writer; - const string output = writer.write(config); - std::ofstream outfile(filepath); if (outfile.is_open()) { - outfile.write(output.c_str(), output.length()); + outfile.write(config.toStyledString().c_str(), + config.toStyledString().length()); outfile.close(); return true;