Added ability to supply JSON from standard input
This commit is contained in:
@@ -141,15 +141,20 @@ bool read_config_json(json& cfg, const string& filename, ostream* log)
|
||||
{
|
||||
if (nullptr != log)
|
||||
{
|
||||
*log << "Could not open config.json" << endl;
|
||||
*log << "Could not open config file" << endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return read_config_json(cfg, cfg_file, log);
|
||||
}
|
||||
|
||||
bool read_config_json(json& cfg, istream& in, ostream* log)
|
||||
{
|
||||
// Parse with comments
|
||||
try
|
||||
{
|
||||
cfg = json::parse(cfg_file, nullptr, true, true);
|
||||
cfg = json::parse(in, nullptr, true, true);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user