QFile::copy: add the underlying error messages to ours

Fixes: QTBUG-100867
Pick-to: 6.3
Change-Id: Ic15405335d804bdea761fffd16d401a7c16f32f9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
bb10
Thiago Macieira 2022-02-15 08:13:03 -08:00
parent 8f1a827d91
commit d34282dba0
1 changed files with 4 additions and 2 deletions

View File

@ -817,7 +817,8 @@ QFile::copy(const QString &newName)
totalRead += in;
if (in != out.write(block, in)) {
close();
d->setError(QFile::CopyError, tr("Failure to write block"));
d->setError(QFile::CopyError, tr("Failure to write block: %1")
.arg(out.errorString()));
error = true;
break;
}
@ -837,7 +838,8 @@ QFile::copy(const QString &newName)
if (!out.rename(newName)) {
error = true;
close();
d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName));
d->setError(QFile::CopyError, tr("Cannot create %1 for output: %1")
.arg(newName, out.errorString()));
}
}
#ifdef QT_NO_TEMPORARYFILE