Improved JSON config error reporting

Show incorrect lines in config.json together with line number and position.
This commit is contained in:
SChernykh 2020-04-29 11:08:45 +02:00
parent b38046db46
commit 05d3f17f15
5 changed files with 99 additions and 1 deletions

View file

@ -62,3 +62,14 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
return true;
}
bool xmrig::Json::convertOffset(const char* fileName, size_t offset, size_t& line, size_t& pos, std::vector<std::string>& s)
{
std::ifstream ifs(fileName, std::ios_base::in | std::ios_base::binary);
if (!ifs.is_open()) {
return false;
}
return convertOffset(ifs, offset, line, pos, s);
}