Skip to content
Permalink
Browse files

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 d3924adf745280b866de2659d78a338ee14a38f6
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/core/qgsziputils.cpp
@@ -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() );
}

0 comments on commit d3924ad

Please sign in to comment.
You can’t perform that action at this time.