Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use QFile to write zip contents, instead of std::ofstream
Because std::ostream doesn't handle non-ascii paths

Refs #19567
  • Loading branch information
nyalldawson committed Jan 22, 2019
1 parent cccd976 commit d3924ad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/qgsziputils.cpp
Expand Up @@ -94,8 +94,16 @@ bool QgsZipUtils::unzip( const QString &zipFilename, const QString &dir, QString
if ( !QDir( dir ).mkpath( newFile.absolutePath() ) )
QgsMessageLog::logMessage( QString( "Failed to create a subdirectory %1/%2" ).arg( dir ).arg( fileName ) );
}
std::ofstream( newFile.absoluteFilePath().toStdString() ).write( buf, len );

QFile outFile( newFile.absoluteFilePath() );
if ( !outFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
{
QgsMessageLog::logMessage( QStringLiteral( "Could not write to %1" ).arg( newFile.absoluteFilePath() ) );
}
else
{
outFile.write( buf, len );
}
zip_fclose( file );
files.append( newFile.absoluteFilePath() );
}
Expand Down

0 comments on commit d3924ad

Please sign in to comment.