try read config

This commit is contained in:
Vikulov Dmitry
2023-09-29 07:49:00 +03:00
parent c1ad13c2ee
commit 3ce03846e7

View File

@ -1224,21 +1224,29 @@ private:
{
// [ "...", "...", "..." ]
std::wstring sJson = L"";
if (NSFile::CFileBinary::Exists(sFile) && NSFile::CFileBinary::ReadAllTextUtf8(sFile, sJson))
try
{
std::wstring sDelim = L"\"";
std::wstring::size_type pos1 = sJson.find(sDelim);
while ( pos1 != std::wstring::npos )
if (NSFile::CFileBinary::Exists(sFile) && NSFile::CFileBinary::ReadAllTextUtf8(sFile, sJson))
{
std::wstring::size_type pos2 = sJson.find(sDelim, pos1 + 1);
std::wstring sDelim = L"\"";
std::wstring::size_type pos1 = sJson.find(sDelim);
if (pos1 != std::wstring::npos && pos2 > pos1)
arrOutput.push_back(sJson.substr(pos1 + 1, pos2 - pos1 - 1));
while ( pos1 != std::wstring::npos )
{
std::wstring::size_type pos2 = sJson.find(sDelim, pos1 + 1);
pos1 = sJson.find(sDelim, pos2 + 1);
if (pos1 != std::wstring::npos && pos2 > pos1)
arrOutput.push_back(sJson.substr(pos1 + 1, pos2 - pos1 - 1));
pos1 = sJson.find(sDelim, pos2 + 1);
}
}
}
catch(...)
{
Message(L"Can't read file: " + sFile, L"", true);
}
return arrOutput.size() > 0;
}