mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Merge remote-tracking branch 'origin/hotfix/v5.1.4' into develop
# Conflicts: # DesktopEditor/common/Directory.h # DesktopEditor/common/File.h
This commit is contained in:
@ -39,8 +39,16 @@ COfficeUtils::COfficeUtils(OnProgressCallback* fCallback)
|
||||
m_fCallback = fCallback;
|
||||
}
|
||||
|
||||
HRESULT COfficeUtils::ExtractToDirectory(const std::wstring& zipFile, const std::wstring& unzipDir, wchar_t* password, SHORT extract_without_path)
|
||||
HRESULT COfficeUtils::ExtractToDirectory(const std::wstring& _zipFile, const std::wstring& _unzipDir, wchar_t* password, SHORT extract_without_path)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
std::wstring zipFile = CorrectPathW(_zipFile);
|
||||
std::wstring unzipDir = CorrectPathW(_unzipDir);
|
||||
#else
|
||||
std::wstring zipFile = _zipFile;
|
||||
std::wstring unzipDir = _unzipDir;
|
||||
#endif
|
||||
|
||||
if( ZLibZipUtils::UnzipToDir( zipFile.c_str(), unzipDir.c_str(), m_fCallback, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
|
||||
{
|
||||
return S_OK;
|
||||
@ -52,8 +60,16 @@ HRESULT COfficeUtils::ExtractToDirectory(const std::wstring& zipFile, const std:
|
||||
}
|
||||
|
||||
|
||||
HRESULT COfficeUtils::CompressFileOrDirectory(const std::wstring& name, const std::wstring& outputFile, bool bSorted, int method, short level)
|
||||
HRESULT COfficeUtils::CompressFileOrDirectory(const std::wstring& _name, const std::wstring& _outputFile, bool bSorted, int method, short level)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
std::wstring name = _name;//CorrectPathW(_name);
|
||||
std::wstring outputFile = CorrectPathW(_outputFile);
|
||||
#else
|
||||
std::wstring name = _name;
|
||||
std::wstring outputFile = _outputFile;
|
||||
#endif
|
||||
|
||||
HRESULT result = S_FALSE;
|
||||
if(NSDirectory::Exists(name))
|
||||
{
|
||||
@ -104,8 +120,14 @@ HRESULT COfficeUtils::Compress(BYTE* destBuf, ULONG* destSize, BYTE* sourceBuf,
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT COfficeUtils::IsArchive(const std::wstring& filename)
|
||||
HRESULT COfficeUtils::IsArchive(const std::wstring& _filename)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
std::wstring filename = CorrectPathW(_filename);
|
||||
#else
|
||||
std::wstring filename = _filename;
|
||||
#endif
|
||||
|
||||
if( ZLibZipUtils::IsArchive(filename.c_str()) )
|
||||
{
|
||||
return S_OK;
|
||||
@ -116,8 +138,14 @@ HRESULT COfficeUtils::IsArchive(const std::wstring& filename)
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT COfficeUtils::IsFileExistInArchive(const std::wstring& zipFile, const std::wstring& filePath)
|
||||
HRESULT COfficeUtils::IsFileExistInArchive(const std::wstring& _zipFile, const std::wstring& filePath)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
std::wstring zipFile = CorrectPathW(_zipFile);
|
||||
#else
|
||||
std::wstring zipFile = _zipFile;
|
||||
#endif
|
||||
|
||||
if( ZLibZipUtils::IsFileExistInArchive( zipFile.c_str(), filePath.c_str()) )
|
||||
{
|
||||
return S_OK;
|
||||
@ -128,8 +156,14 @@ HRESULT COfficeUtils::IsFileExistInArchive(const std::wstring& zipFile, const st
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT COfficeUtils::LoadFileFromArchive(const std::wstring& zipFile, const std::wstring& filePath, BYTE** fileInBytes, ULONG& nFileSize)
|
||||
HRESULT COfficeUtils::LoadFileFromArchive(const std::wstring& _zipFile, const std::wstring& filePath, BYTE** fileInBytes, ULONG& nFileSize)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
std::wstring zipFile = CorrectPathW(_zipFile);
|
||||
#else
|
||||
std::wstring zipFile = _zipFile;
|
||||
#endif
|
||||
|
||||
if( ZLibZipUtils::LoadFileFromArchive( zipFile.c_str(), filePath.c_str(), fileInBytes, nFileSize))
|
||||
{
|
||||
return S_OK;
|
||||
@ -140,20 +174,38 @@ HRESULT COfficeUtils::LoadFileFromArchive(const std::wstring& zipFile, const std
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT COfficeUtils::ExtractFilesToMemory(const std::wstring& zipFile, const ExtractedFileCallback& data_receiver, void* pParam, bool* result)
|
||||
HRESULT COfficeUtils::ExtractFilesToMemory(const std::wstring& _zipFile, const ExtractedFileCallback& data_receiver, void* pParam, bool* result)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
std::wstring zipFile = CorrectPathW(_zipFile);
|
||||
#else
|
||||
std::wstring zipFile = _zipFile;
|
||||
#endif
|
||||
|
||||
*result = ZLibZipUtils::ExtractFiles(zipFile.c_str(), data_receiver, pParam) ? true : false;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COfficeUtils::CompressFilesFromMemory(const std::wstring& zipFile, const RequestFileCallback& data_source, void* pParam, SHORT compression_level, bool* result)
|
||||
HRESULT COfficeUtils::CompressFilesFromMemory(const std::wstring& _zipFile, const RequestFileCallback& data_source, void* pParam, SHORT compression_level, bool* result)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
std::wstring zipFile = CorrectPathW(_zipFile);
|
||||
#else
|
||||
std::wstring zipFile = _zipFile;
|
||||
#endif
|
||||
|
||||
*result = ZLibZipUtils::CompressFiles(zipFile.c_str(), data_source, pParam, compression_level) ? true : false;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COfficeUtils::GetFilesSize(const std::wstring& zipFile, const std::wstring& searchPattern, ULONG& nCommpressed, ULONG& nUncommpressed)
|
||||
HRESULT COfficeUtils::GetFilesSize(const std::wstring& _zipFile, const std::wstring& searchPattern, ULONG& nCommpressed, ULONG& nUncommpressed)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
std::wstring zipFile = CorrectPathW(_zipFile);
|
||||
#else
|
||||
std::wstring zipFile = _zipFile;
|
||||
#endif
|
||||
|
||||
if (ZLibZipUtils::GetFilesSize(zipFile.c_str(), searchPattern, nCommpressed, nUncommpressed))
|
||||
{
|
||||
return S_OK;
|
||||
|
||||
Reference in New Issue
Block a user