예제 #1
0
bool Settings::updateConfigFile(const std::string &filename)
{
	if (filename.find(".json") != std::string::npos) {
		writeJsonFile(filename);
		return true;
	}

	JMutexAutoLock lock(m_mutex);

	std::ifstream is(filename);
	std::ostringstream os(std::ios_base::binary);

	bool was_modified = updateConfigObject(is, os, "");
	is.close();

	if (!was_modified)
		return true;

	if (!fs::safeWriteToFile(filename.c_str(), os.str())) {
		errorstream << "Error writing configuration file: \""
			<< filename << "\"" << std::endl;
		return false;
	}

	return true;
}
예제 #2
0
void RoundConfig::saveJsonFile(std::string path) const {
  Json::Value obj = buildJson();
  cleanJsonVal(obj);
  writeJsonFile(path, obj);
}