mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
x2t - fix bug #46662
This commit is contained in:
@ -634,6 +634,7 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
|
||||
wstring szText;
|
||||
|
||||
zipFile zf = zipOpenHelp(outputFile);
|
||||
if (!zf) return -1;
|
||||
|
||||
unsigned int filesCount = get_files_count( dir );
|
||||
unsigned int currentFileIndex = 0;
|
||||
@ -760,36 +761,38 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
|
||||
if(oFile.ReadFile(pData, oFile.GetFileSize(), dwSizeRead))
|
||||
{
|
||||
zipFile zf = zipOpenHelp(outputFile);
|
||||
if (zf)
|
||||
{
|
||||
wstring inputFileName( inputFile );
|
||||
|
||||
wstring inputFileName( inputFile );
|
||||
wstring::size_type pos = 0;
|
||||
static const wstring::size_type npos = -1;
|
||||
|
||||
wstring::size_type pos = 0;
|
||||
static const wstring::size_type npos = -1;
|
||||
pos = inputFileName.find_last_of( L'\\' );
|
||||
|
||||
pos = inputFileName.find_last_of( L'\\' );
|
||||
wstring zipFileName;
|
||||
|
||||
wstring zipFileName;
|
||||
if ( pos != npos )
|
||||
{
|
||||
zipFileName = wstring( ( inputFileName.begin() + pos + 1 ), inputFileName.end() );
|
||||
}
|
||||
else
|
||||
{
|
||||
zipFileName = wstring( inputFileName.begin(), inputFileName.end() );
|
||||
}
|
||||
std::string zipFileNameA = codepage_issue_fixToOEM(zipFileName);
|
||||
|
||||
if ( pos != npos )
|
||||
{
|
||||
zipFileName = wstring( ( inputFileName.begin() + pos + 1 ), inputFileName.end() );
|
||||
}
|
||||
else
|
||||
{
|
||||
zipFileName = wstring( inputFileName.begin(), inputFileName.end() );
|
||||
}
|
||||
std::string zipFileNameA = codepage_issue_fixToOEM(zipFileName);
|
||||
|
||||
err = zipOpenNewFileInZip( zf, zipFileNameA.c_str(), &zinfo, NULL, 0, NULL, 0, NULL, method, compressionLevel );
|
||||
err = zipWriteInFileInZip( zf, pData, dwSizeRead );
|
||||
err = zipCloseFileInZip( zf );
|
||||
err = zipClose( zf, NULL );
|
||||
err = zipOpenNewFileInZip( zf, zipFileNameA.c_str(), &zinfo, NULL, 0, NULL, 0, NULL, method, compressionLevel );
|
||||
err = zipWriteInFileInZip( zf, pData, dwSizeRead );
|
||||
err = zipCloseFileInZip( zf );
|
||||
err = zipClose( zf, NULL );
|
||||
}
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return err;
|
||||
}
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
Reference in New Issue
Block a user