Skip to content

Commit

Permalink
Fix compilation by taking libzip version into account
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Jul 31, 2017
1 parent ba74e64 commit 2d660a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/qgsziputils.cpp
Expand Up @@ -141,7 +141,12 @@ bool QgsZipUtils::zip( const QString &zipFilename, const QStringList &files )
zip_source *src = zip_source_file( z, file.toStdString().c_str(), 0, 0 );
if ( src != NULL )
{
if ( zip_file_add( z, fileInfo.fileName().toStdString().c_str(), src, 0 ) == -1 )
#if LIBZIP_VERSION_MAJOR < 1
int rc = ( int ) zip_add( z, fileInfo.fileName().toStdString().c_str(), src );
#else
int rc = ( int ) zip_file_add( z, fileInfo.fileName().toStdString().c_str(), src, 0 );
#endif
if ( rc == -1 )
{
QString err = QObject::tr( "Error adding file: '%1'" ).arg( zip_strerror( z ) );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
Expand Down

0 comments on commit 2d660a1

Please sign in to comment.