mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Use QFile to write zip contents, instead of std::ofstream
Because std::ostream doesn't handle non-ascii paths Refs #19567
This commit is contained in:
parent
cccd9766c2
commit
d3924adf74
@ -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() );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user