| 81 | } |
| 82 | |
| 83 | bool TYandexConfig::Read(const TString& path) { |
| 84 | assert(FileData == nullptr); |
| 85 | ConfigPath = path; |
| 86 | //read the file to memory |
| 87 | TFile doc(path, OpenExisting | RdOnly); |
| 88 | if (!doc.IsOpen()) { |
| 89 | Errors.push_back(TString("can't open file ") + path + "\n"); |
| 90 | return false; |
| 91 | } |
| 92 | Len = (ui32)doc.GetLength(); |
| 93 | FileData = new char[Len + 1]; |
| 94 | doc.Load(FileData, Len); |
| 95 | FileData[Len] = 0; |
| 96 | doc.Close(); |
| 97 | return PrepareLines(); |
| 98 | } |
| 99 | |
| 100 | bool TYandexConfig::ReadMemory(const TStringBuf& buffer, const char* configPath) { |
| 101 | assert(FileData == nullptr); |
no test coverage detected