mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
bullshit off
This commit is contained in:
@ -1055,26 +1055,25 @@ private:
|
|||||||
|
|
||||||
bool ReadConfigJson(const std::wstring& sFile, std::vector<std::wstring>& arrOutput)
|
bool ReadConfigJson(const std::wstring& sFile, std::vector<std::wstring>& arrOutput)
|
||||||
{
|
{
|
||||||
bool bResult = false;
|
// [ "...", "...", "..." ]
|
||||||
|
|
||||||
std::wstring sJson = L"";
|
std::wstring sJson = L"";
|
||||||
if (NSFile::CFileBinary::Exists(sFile) && NSFile::CFileBinary::ReadAllTextUtf8(sFile, sJson))
|
if (NSFile::CFileBinary::Exists(sFile) && NSFile::CFileBinary::ReadAllTextUtf8(sFile, sJson))
|
||||||
{
|
{
|
||||||
NSStringUtils::string_replace(sJson, L"\n", L"");
|
std::wstring sDelim = L"\"";
|
||||||
NSStringUtils::string_replace(sJson, L"\r", L"");
|
std::wstring::size_type pos1 = sJson.find(sDelim);
|
||||||
NSStringUtils::string_replace(sJson, L"\t", L"");
|
|
||||||
NSStringUtils::string_replace(sJson, L"[", L"");
|
|
||||||
NSStringUtils::string_replace(sJson, L"]", L"");
|
|
||||||
|
|
||||||
StringReplaceExt(sJson, L" \"", L"\"");
|
while ( pos1 != std::wstring::npos )
|
||||||
StringReplaceExt(sJson, L"\" ", L"\"");
|
{
|
||||||
|
std::wstring::size_type pos2 = sJson.find(sDelim, pos1 + 1);
|
||||||
|
|
||||||
NSStringUtils::string_replace(sJson, L"\"", L"");
|
if (pos1 != std::wstring::npos && pos2 > pos1)
|
||||||
|
arrOutput.push_back(sJson.substr(pos1 + 1, pos2 - pos1 - 1));
|
||||||
|
|
||||||
bResult = SplitStringAsVector(sJson, L",", arrOutput);
|
pos1 = sJson.find(sDelim, pos2 + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return arrOutput.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringReplaceExt(std::wstring& sText, const std::wstring& sFrom, const std::wstring& sTo)
|
void StringReplaceExt(std::wstring& sText, const std::wstring& sFrom, const std::wstring& sTo)
|
||||||
|
|||||||
Reference in New Issue
Block a user