Skip to content

Commit 2d660a1

Browse files
committedJul 31, 2017
Fix compilation by taking libzip version into account
1 parent ba74e64 commit 2d660a1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/core/qgsziputils.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ bool QgsZipUtils::zip( const QString &zipFilename, const QStringList &files )
141141
zip_source *src = zip_source_file( z, file.toStdString().c_str(), 0, 0 );
142142
if ( src != NULL )
143143
{
144-
if ( zip_file_add( z, fileInfo.fileName().toStdString().c_str(), src, 0 ) == -1 )
144+
#if LIBZIP_VERSION_MAJOR < 1
145+
int rc = ( int ) zip_add( z, fileInfo.fileName().toStdString().c_str(), src );
146+
#else
147+
int rc = ( int ) zip_file_add( z, fileInfo.fileName().toStdString().c_str(), src, 0 );
148+
#endif
149+
if ( rc == -1 )
145150
{
146151
QString err = QObject::tr( "Error adding file: '%1'" ).arg( zip_strerror( z ) );
147152
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );

0 commit comments

Comments
 (0)
Please sign in to comment.