mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-24 22:46:14 +02:00
restore config
This commit is contained in:
parent
5d68e36718
commit
4c94025747
2 changed files with 21 additions and 10 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue