Fix build

This commit is contained in:
Oleg Korshul
2021-06-01 12:12:47 +03:00
parent c7c15ea254
commit 073d7b4d8b
6 changed files with 25 additions and 26 deletions

View File

@ -118,7 +118,7 @@ std::string CV8RealTimeWorker::GetGlobalVariable()
std::wstring CV8RealTimeWorker::GetJSVariable(std::wstring sParam)
{
std::string sParamA = U_TO_UTF8(sParam);
NSCommon::string_replaceA(sParamA, "\\\"", "\"");
NSStringUtils::string_replaceA(sParamA, "\\\"", "\"");
std::string commandA = "(function(){ return (" + sParamA + "); })()";
JSSmart<CJSContextScope> context_scope = m_context->CreateContextScope();
@ -152,8 +152,8 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
std::string sArg = m_sUtf8ArgumentJSON;
if (sArg.empty())
sArg = "{}";
NSCommon::string_replaceA(sArg, "\\", "\\\\");
NSCommon::string_replaceA(sArg, "\"", "\\\"");
NSStringUtils::string_replaceA(sArg, "\\", "\\\\");
NSStringUtils::string_replaceA(sArg, "\"", "\\\"");
std::string sArgument = "var Argument = JSON.parse(\"" + sArg + "\");";
m_context->runScript(sArgument, try_catch);
@ -166,8 +166,8 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
std::string sArg = m_sGlobalVariable;
if (sArg.empty())
sArg = "{}";
NSCommon::string_replaceA(sArg, "\\", "\\\\");
NSCommon::string_replaceA(sArg, "\"", "\\\"");
NSStringUtils::string_replaceA(sArg, "\\", "\\\\");
NSStringUtils::string_replaceA(sArg, "\"", "\\\"");
std::string sScriptVar = "var GlobalVariable = JSON.parse(\"" + sArg + "\");";
@ -231,7 +231,7 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
JSSmart<CJSValue> args_open[3];
args_open[0] = oWorkerLoader.GetDataFull()->toObject()->toValue();
args_open[1] = CJSContext::createInt(nVersion);
std::wstring sXlsx = NSCommon::GetDirectoryName(pNative->GetFilePath()) + L"/Editor.xlsx";
std::wstring sXlsx = NSFile::GetDirectoryName(pNative->GetFilePath()) + L"/Editor.xlsx";
args_open[2] = NSFile::CFileBinary::Exists(sXlsx) ? CJSContext::createString(sXlsx) : CJSContext::createUndefined();
global_js->call_func("NativeOpenFileData", 3, args_open);

View File

@ -312,7 +312,7 @@ namespace NSDoctRenderer
void CheckFonts(bool bIsCheckFonts)
{
std::wstring sDirectory = NSCommon::GetDirectoryName(m_strAllFonts);
std::wstring sDirectory = NSFile::GetDirectoryName(m_strAllFonts);
std::wstring strFontsSelectionBin = sDirectory + L"/font_selection.bin";
if (!bIsCheckFonts && NSFile::CFileBinary::Exists(strFontsSelectionBin))
@ -334,7 +334,7 @@ namespace NSDoctRenderer
if (NSFile::CFileBinary::Exists(m_sFileDir))
NSFile::CFileBinary::Remove(m_sFileDir);
NSCommon::string_replace(m_sFileDir, L"\\", L"/");
NSStringUtils::string_replace(m_sFileDir, L"\\", L"/");
std::wstring::size_type nPosPoint = m_sFileDir.rfind('.');
if (nPosPoint != std::wstring::npos && nPosPoint > m_sTmpFolder.length())
@ -472,7 +472,7 @@ namespace NSDoctRenderer
else
{
oBuilder.WriteString(L"<m_sFontDir>");
oBuilder.WriteEncodeXmlString(NSCommon::GetDirectoryName(m_strAllFonts));
oBuilder.WriteEncodeXmlString(NSFile::GetDirectoryName(m_strAllFonts));
oBuilder.WriteString(L"</m_sFontDir>");
oBuilder.WriteString(L"<m_sAllFontsPath>");
@ -604,7 +604,7 @@ namespace NSDoctRenderer
std::wstring GetFileCopyExt(const std::wstring& path)
{
std::wstring sExtCopy = NSCommon::GetFileExtention(path);
std::wstring sExtCopy = NSFile::GetFileExtention(path);
if (true)
{
@ -702,10 +702,10 @@ namespace NSDoctRenderer
wchar_t last = m_sFolderForSaveOnlyUseNames.c_str()[m_sFolderForSaveOnlyUseNames.length() - 1];
if (last != '/' && last != '\\')
_path += L"/";
_path += NSCommon::GetFileName(path);
_path += NSFile::GetFileName(path);
}
std::wstring sDstFileDir = NSCommon::GetDirectoryName(_path);
std::wstring sDstFileDir = NSFile::GetDirectoryName(_path);
if ((sDstFileDir != _path) && !NSDirectory::Exists(sDstFileDir))
NSDirectory::CreateDirectories(sDstFileDir);
@ -782,7 +782,7 @@ namespace NSDoctRenderer
else
{
oBuilder.WriteString(L"<m_sFontDir>");
oBuilder.WriteEncodeXmlString(NSCommon::GetDirectoryName(m_strAllFonts));
oBuilder.WriteEncodeXmlString(NSFile::GetDirectoryName(m_strAllFonts));
oBuilder.WriteString(L"</m_sFontDir>");
oBuilder.WriteString(L"<m_sAllFontsPath>");
@ -1030,7 +1030,7 @@ namespace NSDoctRenderer
if (0 < arSdkFiles->size())
{
return NSCommon::GetDirectoryName(*arSdkFiles->begin()) + L"/sdk-all.cache";
return NSFile::GetDirectoryName(*arSdkFiles->begin()) + L"/sdk-all.cache";
}
return L"";
}
@ -1066,7 +1066,7 @@ namespace NSDoctRenderer
{
std::wstring sValue(value);
std::string sValueA = U_TO_UTF8(sValue);
NSCommon::string_replaceA(sValueA, "%", "%%");
NSStringUtils::string_replaceA(sValueA, "%", "%%");
std::wstring _sFile(path);
std::wstring sFile = GetSaveFilePath(_sFile);

View File

@ -724,7 +724,7 @@ namespace NSDoctRenderer
JSSmart<CJSValue> args_open[4];
args_open[0] = oWorkerLoader.GetDataFull()->toValue();
args_open[1] = CJSContext::createInt(nVersion);
std::wstring sXlsx = NSCommon::GetDirectoryName(pNative->GetFilePath()) + L"/Editor.xlsx";
std::wstring sXlsx = NSFile::GetDirectoryName(pNative->GetFilePath()) + L"/Editor.xlsx";
args_open[2] = NSFile::CFileBinary::Exists(sXlsx) ? CJSContext::createString(sXlsx) : CJSContext::createUndefined();
JSSmart<CJSObject> globalParams = CJSContext::createObject();
if (0 < m_oParams.m_nLcid)

View File

@ -2,7 +2,6 @@
#include "./../docbuilder_p.h"
#include "../../common/Directory.h"
#include "../../fontengine/application_generate_fonts_common.h"
JSSmart<CJSValue> CBuilderEmbed::builder_OpenFile(JSSmart<CJSValue> sPath, JSSmart<CJSValue> sParams)
{
@ -66,7 +65,7 @@ JSSmart<CJSValue> CBuilderDocumentEmbed::builder_doc_GetImageMap()
for (std::vector<std::wstring>::iterator i = files.begin(); i != files.end(); i++)
{
std::wstring sFile = *i;
NSCommon::string_replace(sFile, L"\\", L"/");
NSStringUtils::string_replace(sFile, L"\\", L"/");
std::wstring sName = L"media/" + NSFile::GetFileName(sFile);
obj->set(U_TO_UTF8(sName).c_str(), CJSContext::createString(sFile));
@ -85,7 +84,7 @@ void CBuilderDocumentEmbed::OpenFile(const std::wstring& sFile, const std::wstri
if (NSFile::CFileBinary::Exists(m_sFolder))
NSFile::CFileBinary::Remove(m_sFolder);
NSCommon::string_replace(m_sFolder, L"\\", L"/");
NSStringUtils::string_replace(m_sFolder, L"\\", L"/");
std::wstring::size_type nPosPoint = m_sFolder.rfind('.');
if (nPosPoint != std::wstring::npos && nPosPoint > sTmpDir.length())

View File

@ -59,7 +59,7 @@ std::wstring CImagesWorker::GetImage(const std::wstring& sUrl)
if (sUrlFile.find(L"localhost") == 0)
sUrlFile = sUrlFile.substr(9);
NSCommon::string_replace(sUrlFile, L"%20", L" ");
NSStringUtils::string_replace(sUrlFile, L"%20", L" ");
if (!NSFile::CFileBinary::Exists(sUrlFile))
sUrlFile = sUrlFile.substr(1);

View File

@ -39,10 +39,10 @@
#include "../graphics/Timer.h"
#include "../common/Directory.h"
#include "../common/Array.h"
#include "../common/StringBuilder.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "js_internal/js_base.h"
#include "../fontengine/application_generate_fonts_common.h"
#if defined(CreateDirectory)
#undef CreateDirectory
@ -182,7 +182,7 @@ private:
void url_correct2(std::wstring& url)
{
NSCommon::string_replace(url, L"/./", L"/");
NSStringUtils::string_replace(url, L"/./", L"/");
size_t posn = 0;
while (std::wstring::npos != (posn = url.find(L"/../")))
@ -195,9 +195,9 @@ private:
}
}
NSCommon::string_replace(url, L"\\\\", L"\\");
NSCommon::string_replace(url, L"//", L"/");
NSCommon::string_replace(url, L"\\", L"/");
NSStringUtils::string_replace(url, L"\\\\", L"\\");
NSStringUtils::string_replace(url, L"//", L"/");
NSStringUtils::string_replace(url, L"\\", L"/");
}
};
@ -346,7 +346,7 @@ public:
{
m_strFilePath = strPath;
m_oZipWorker.m_sWorkerFolder = NSCommon::GetDirectoryName(strPath);
m_oZipWorker.m_sWorkerFolder = NSFile::GetDirectoryName(strPath);
}
std::wstring GetFilePath()
{