mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
@ -243,11 +243,9 @@ protected:
|
|||||||
{
|
{
|
||||||
if (m_sFilePath.empty())
|
if (m_sFilePath.empty())
|
||||||
{
|
{
|
||||||
NSFile::CFileBinary file;
|
m_sFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"DW");
|
||||||
|
if (NSFile::CFileBinary::Exists(m_sFilePath))
|
||||||
m_sFilePath = file.CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"DW");
|
NSFile::CFileBinary::Remove(m_sFilePath);
|
||||||
if (file.Exists(m_sFilePath))
|
|
||||||
file.Remove(m_sFilePath);
|
|
||||||
}
|
}
|
||||||
return download_external(m_sFileUrl, m_sFilePath);
|
return download_external(m_sFileUrl, m_sFilePath);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -203,10 +203,9 @@ namespace NSDoctRenderer
|
|||||||
|
|
||||||
m_sTmpFolder = NSFile::CFileBinary::GetTempPath();
|
m_sTmpFolder = NSFile::CFileBinary::GetTempPath();
|
||||||
|
|
||||||
NSFile::CFileBinary file;
|
|
||||||
// под линуксом предыдущая функция создает файл!!!
|
// под линуксом предыдущая функция создает файл!!!
|
||||||
if (file.Exists(m_sTmpFolder))
|
if (NSFile::CFileBinary::Exists(m_sTmpFolder))
|
||||||
file.Remove(m_sTmpFolder);
|
NSFile::CFileBinary::Remove(m_sTmpFolder);
|
||||||
|
|
||||||
m_pAdditionalData = NULL;
|
m_pAdditionalData = NULL;
|
||||||
m_bIsInit = false;
|
m_bIsInit = false;
|
||||||
@ -409,16 +408,15 @@ namespace NSDoctRenderer
|
|||||||
|
|
||||||
if (!bIsEqual)
|
if (!bIsEqual)
|
||||||
{
|
{
|
||||||
NSFile::CFileBinary oFile;
|
if (NSFile::CFileBinary::Exists(strAllFontsJSPath))
|
||||||
|
NSFile::CFileBinary::Remove(strAllFontsJSPath);
|
||||||
if (oFile.Exists(strAllFontsJSPath))
|
if (NSFile::CFileBinary::Exists(strFontsSelectionBin))
|
||||||
oFile.Remove(strAllFontsJSPath);
|
NSFile::CFileBinary::Remove(strFontsSelectionBin);
|
||||||
if (oFile.Exists(strFontsSelectionBin))
|
|
||||||
oFile.Remove(strFontsSelectionBin);
|
|
||||||
|
|
||||||
if (strFonts.size() != 0)
|
if (strFonts.size() != 0)
|
||||||
oFile.Remove(strDirectory + L"/fonts.log");
|
NSFile::CFileBinary::Remove(strDirectory + L"/fonts.log");
|
||||||
|
|
||||||
|
NSFile::CFileBinary oFile;
|
||||||
oFile.CreateFileW(strDirectory + L"/fonts.log");
|
oFile.CreateFileW(strDirectory + L"/fonts.log");
|
||||||
int nCount = (int)strFontsW_Cur.size();
|
int nCount = (int)strFontsW_Cur.size();
|
||||||
for (int i = 0; i < nCount; ++i)
|
for (int i = 0; i < nCount; ++i)
|
||||||
@ -438,11 +436,9 @@ namespace NSDoctRenderer
|
|||||||
|
|
||||||
void CheckFileDir()
|
void CheckFileDir()
|
||||||
{
|
{
|
||||||
NSFile::CFileBinary oFile;
|
m_sFileDir = NSFile::CFileBinary::CreateTempFileWithUniqueName(m_sTmpFolder, L"DE_");
|
||||||
|
if (NSFile::CFileBinary::Exists(m_sFileDir))
|
||||||
m_sFileDir = oFile.CreateTempFileWithUniqueName(m_sTmpFolder, L"DE_");
|
NSFile::CFileBinary::Remove(m_sFileDir);
|
||||||
if (oFile.Exists(m_sFileDir))
|
|
||||||
oFile.Remove(m_sFileDir);
|
|
||||||
|
|
||||||
NSCommon::string_replace(m_sFileDir, L"\\", L"/");
|
NSCommon::string_replace(m_sFileDir, L"\\", L"/");
|
||||||
|
|
||||||
@ -710,8 +706,7 @@ namespace NSDoctRenderer
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NSFile::CFileBinary file;
|
NSFile::CFileBinary::Remove(sTempFileForParams);
|
||||||
file.Remove(sTempFileForParams);
|
|
||||||
|
|
||||||
return nReturnCode;
|
return nReturnCode;
|
||||||
}
|
}
|
||||||
@ -1001,8 +996,7 @@ namespace NSDoctRenderer
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NSFile::CFileBinary file;
|
NSFile::CFileBinary::Remove(sTempFileForParams);
|
||||||
file.Remove(sTempFileForParams);
|
|
||||||
|
|
||||||
LOGGER_SPEED_LAP("save_convert")
|
LOGGER_SPEED_LAP("save_convert")
|
||||||
|
|
||||||
@ -1161,11 +1155,10 @@ namespace NSDoctRenderer
|
|||||||
std::wstring _sFile(path);
|
std::wstring _sFile(path);
|
||||||
std::wstring sFile = GetSaveFilePath(_sFile);
|
std::wstring sFile = GetSaveFilePath(_sFile);
|
||||||
|
|
||||||
|
if (!append && NSFile::CFileBinary::Exists(sFile))
|
||||||
|
NSFile::CFileBinary::Remove(sFile);
|
||||||
|
|
||||||
NSFile::CFileBinary oFile;
|
NSFile::CFileBinary oFile;
|
||||||
|
|
||||||
if (!append && oFile.Exists(sFile))
|
|
||||||
oFile.Remove(sFile);
|
|
||||||
|
|
||||||
FILE* pFile = oFile.OpenFileNative(sFile, append ? L"a+" : L"a");
|
FILE* pFile = oFile.OpenFileNative(sFile, append ? L"a+" : L"a");
|
||||||
if (pFile)
|
if (pFile)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,11 +38,9 @@ void CBuilderDocumentEmbed::OpenFile(const std::wstring& sFile, const std::wstri
|
|||||||
|
|
||||||
std::wstring sTmpDir = pBuilder->m_sTmpFolder;
|
std::wstring sTmpDir = pBuilder->m_sTmpFolder;
|
||||||
|
|
||||||
NSFile::CFileBinary file;
|
m_sFolder = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"DE_");
|
||||||
m_sFolder = file.CreateTempFileWithUniqueName(sTmpDir, L"DE_");
|
if (NSFile::CFileBinary::Exists(m_sFolder))
|
||||||
|
NSFile::CFileBinary::Remove(m_sFolder);
|
||||||
if (file.Exists(m_sFolder))
|
|
||||||
file.Remove(m_sFolder);
|
|
||||||
|
|
||||||
NSCommon::string_replace(m_sFolder, L"\\", L"/");
|
NSCommon::string_replace(m_sFolder, L"\\", L"/");
|
||||||
|
|
||||||
|
|||||||
@ -91,11 +91,9 @@ std::wstring CImagesWorker::GetImage(const std::wstring& sUrl)
|
|||||||
{
|
{
|
||||||
CFileDownloader oDownloader(sUrl, false);
|
CFileDownloader oDownloader(sUrl, false);
|
||||||
|
|
||||||
NSFile::CFileBinary file;
|
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"IMG");
|
||||||
std::wstring sTmpFile = file.CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"IMG");
|
if (NSFile::CFileBinary::Exists(sTmpFile))
|
||||||
|
NSFile::CFileBinary::Remove(sTmpFile);
|
||||||
if (file.Exists(sTmpFile))
|
|
||||||
file.Remove(sTmpFile);
|
|
||||||
sTmpFile = sTmpFile + L".png";
|
sTmpFile = sTmpFile + L".png";
|
||||||
|
|
||||||
oDownloader.SetFilePath(sTmpFile);
|
oDownloader.SetFilePath(sTmpFile);
|
||||||
@ -116,7 +114,7 @@ std::wstring CImagesWorker::GetImage(const std::wstring& sUrl)
|
|||||||
|
|
||||||
oFrame.SaveFile(m_sFolder + L"/media/" + sRet, 4);
|
oFrame.SaveFile(m_sFolder + L"/media/" + sRet, 4);
|
||||||
|
|
||||||
file.Remove(sTmpFile);
|
NSFile::CFileBinary::Remove(sTmpFile);
|
||||||
return sRet;
|
return sRet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,12 +106,11 @@ public:
|
|||||||
if (true != NSFile::CBase64Converter::Decode(sData.c_str(), (int)sData.length(), pRawData, nRawSize))
|
if (true != NSFile::CBase64Converter::Decode(sData.c_str(), (int)sData.length(), pRawData, nRawSize))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"ZIP");
|
||||||
|
if (NSFile::CFileBinary::Exists(sTmpFile))
|
||||||
|
NSFile::CFileBinary::Remove(sTmpFile);
|
||||||
|
|
||||||
NSFile::CFileBinary oFile;
|
NSFile::CFileBinary oFile;
|
||||||
|
|
||||||
std::wstring sTmpFile = oFile.CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"ZIP");
|
|
||||||
if (oFile.Exists(sTmpFile))
|
|
||||||
oFile.Remove(sTmpFile);
|
|
||||||
|
|
||||||
oFile.CreateFileW(sTmpFile);
|
oFile.CreateFileW(sTmpFile);
|
||||||
oFile.WriteFile(pRawData, (DWORD)nRawSize);
|
oFile.WriteFile(pRawData, (DWORD)nRawSize);
|
||||||
oFile.CloseFile();
|
oFile.CloseFile();
|
||||||
@ -122,11 +121,11 @@ public:
|
|||||||
NSDirectory::CreateDirectory(m_sTmpFolder);
|
NSDirectory::CreateDirectory(m_sTmpFolder);
|
||||||
if (S_OK != oUtils.ExtractToDirectory(sTmpFile, m_sTmpFolder, NULL, 0))
|
if (S_OK != oUtils.ExtractToDirectory(sTmpFile, m_sTmpFolder, NULL, 0))
|
||||||
{
|
{
|
||||||
oFile.Remove(sTmpFile);
|
NSFile::CFileBinary::Remove(sTmpFile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
oFile.Remove(sTmpFile);
|
NSFile::CFileBinary::Remove(sTmpFile);
|
||||||
CheckDirectory();
|
CheckDirectory();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,10 +192,9 @@ public:
|
|||||||
Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature\" Target=\"sig" + std::to_string(rId) + ".xml\"/>\
|
Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature\" Target=\"sig" + std::to_string(rId) + ".xml\"/>\
|
||||||
</Relationships>");
|
</Relationships>");
|
||||||
|
|
||||||
|
NSFile::CFileBinary::Remove(file);
|
||||||
|
|
||||||
NSFile::CFileBinary oFile;
|
NSFile::CFileBinary oFile;
|
||||||
|
|
||||||
oFile.Remove(file);
|
|
||||||
|
|
||||||
oFile.CreateFileW(file);
|
oFile.CreateFileW(file);
|
||||||
oFile.WriteFile((BYTE*)sRet.c_str(), (DWORD)sRet.length());
|
oFile.WriteFile((BYTE*)sRet.c_str(), (DWORD)sRet.length());
|
||||||
oFile.CloseFile();
|
oFile.CloseFile();
|
||||||
|
|||||||
@ -746,16 +746,15 @@ void CheckFonts(const bool& bIsUseSystemFonts, std::vector<std::wstring>& arDirs
|
|||||||
|
|
||||||
if (!bIsEqual)
|
if (!bIsEqual)
|
||||||
{
|
{
|
||||||
NSFile::CFileBinary oFile;
|
if (NSFile::CFileBinary::Exists(strAllFontsJSPath))
|
||||||
|
NSFile::CFileBinary::Remove(strAllFontsJSPath);
|
||||||
if (oFile.Exists(strAllFontsJSPath))
|
if (NSFile::CFileBinary::Exists(strFontsSelectionBin))
|
||||||
oFile.Remove(strAllFontsJSPath);
|
NSFile::CFileBinary::Remove(strFontsSelectionBin);
|
||||||
if (oFile.Exists(strFontsSelectionBin))
|
|
||||||
oFile.Remove(strFontsSelectionBin);
|
|
||||||
|
|
||||||
if (strFonts.size() != 0)
|
if (strFonts.size() != 0)
|
||||||
oFile.Remove(strDirectory + L"/fonts.log");
|
NSFile::CFileBinary::Remove(strDirectory + L"/fonts.log");
|
||||||
|
|
||||||
|
NSFile::CFileBinary oFile;
|
||||||
oFile.CreateFileW(strDirectory + L"/fonts.log");
|
oFile.CreateFileW(strDirectory + L"/fonts.log");
|
||||||
oFile.WriteStringUTF8(L"ONLYOFFICE_FONTS_VERSION_");
|
oFile.WriteStringUTF8(L"ONLYOFFICE_FONTS_VERSION_");
|
||||||
oFile.WriteStringUTF8(std::to_wstring(ONLYOFFICE_FONTS_VERSION_));
|
oFile.WriteStringUTF8(std::to_wstring(ONLYOFFICE_FONTS_VERSION_));
|
||||||
|
|||||||
Reference in New Issue
Block a user