restore config

This commit is contained in:
badaix 2015-09-05 22:38:27 +02:00
parent 5d68e36718
commit 4c94025747
2 changed files with 21 additions and 10 deletions

View file

@ -31,6 +31,22 @@ Config::Config()
mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
filename_ = dir + "settings.json";
cerr << filename_ << "\n";
ifstream ifs(filename_, std::ifstream::in);
if (ifs.good())
{
json j;
ifs >> j;
json jClient = j["Client"];
for (json::iterator it = jClient.begin(); it != jClient.end(); ++it)
{
ClientInfoPtr client = make_shared<ClientInfo>();
client->fromJson(*it);
clients.push_back(client);
std::cout << "Client:\n" << std::setw(4) << client->toJson() << '\n';
}
}
// fs::create_directory(filename_.parent_path());
}