developing...

This commit is contained in:
Oleg Korshul
2019-10-17 19:35:21 +03:00
parent 79bccd5002
commit 5be7ca2bc5
8 changed files with 142 additions and 41 deletions

View File

@ -55,3 +55,7 @@ HEADERS += \
$$PWD/src/zlib-1.2.11/contrib/minizip/mztools.h \
$$PWD/src/zlib-1.2.11/contrib/minizip/unzip.h \
$$PWD/src/zlib-1.2.11/contrib/minizip/zip.h
core_ios {
OBJECTIVE_SOURCES += $$PWD/src/ZipUtilsCP_ios.mm
}

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
@ -35,10 +35,6 @@
#include "../../DesktopEditor/common/Directory.h"
#include "../../DesktopEditor/common/Path.h"
#if _IOS
#import <Foundation/Foundation.h>
#endif
#if !defined(_WIN32) && !defined (_WIN64)
#include <unistd.h>
#endif
@ -48,15 +44,9 @@
namespace ZLibZipUtils
{
#ifndef _IOS
static zipFile zipOpenHelp(const wchar_t* filename)
{
#ifdef _IOS
NSString *path =[[NSString alloc] initWithBytes:filename
length:wcslen(filename)*sizeof(*filename)
encoding:NSUTF32LittleEndianStringEncoding];
return zipOpen( (const char*)[path fileSystemRepresentation], APPEND_STATUS_CREATE );
#endif
{
#if defined(_WIN32) || defined (_WIN64)
zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc);
@ -71,14 +61,7 @@ namespace ZLibZipUtils
return zf;
}
static unzFile unzOpenHelp(const wchar_t* filename)
{
#ifdef _IOS
NSString *path =[[NSString alloc] initWithBytes:filename
length:wcslen(filename)*sizeof(*filename)
encoding:NSUTF32LittleEndianStringEncoding];
return unzOpen ((const char*)[path fileSystemRepresentation]);
#endif
{
#if defined(_WIN32) || defined (_WIN64)
zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc);
@ -92,6 +75,7 @@ namespace ZLibZipUtils
#endif
return uf;
}
#endif
static std::wstring ascii_to_unicode(const char *src)
{
std::string sAnsi(src);

View File

@ -56,6 +56,9 @@ using namespace std;
namespace ZLibZipUtils
{
zipFile zipOpenHelp(const wchar_t* filename);
unzFile unzOpenHelp(const wchar_t* filename);
int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback* progress, bool sorted = false, int method = Z_DEFLATED, int compressionLevel = -1);
int ZipFile( const WCHAR* inputFile, const WCHAR* outputFile, int method = Z_DEFLATED, int compressionLevel = -1 );
bool ClearDirectory( const WCHAR* dir, bool delDir = false );

View File

@ -0,0 +1,51 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "ZipUtilsCP.h"
#import <Foundation/Foundation.h>
namespace ZLibZipUtils
{
zipFile zipOpenHelp(const wchar_t* filename)
{
NSString *path =[[NSString alloc] initWithBytes:filename
length:wcslen(filename)*sizeof(*filename)
encoding:NSUTF32LittleEndianStringEncoding];
return zipOpen( (const char*)[path fileSystemRepresentation], APPEND_STATUS_CREATE );
}
unzFile unzOpenHelp(const wchar_t* filename)
{
NSString *path =[[NSString alloc] initWithBytes:filename
length:wcslen(filename)*sizeof(*filename)
encoding:NSUTF32LittleEndianStringEncoding];
return unzOpen ((const char*)[path fileSystemRepresentation]);
}
}