forked from qt-creator/qt-creator
Utils: Better error reporting for copyFile
Change-Id: Id76280e83e9dae92bff2db5722f1e582867e1566 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -565,10 +565,13 @@ bool DesktopDeviceFileAccess::removeRecursively(const FilePath &filePath, QStrin
|
||||
expected_str<void> DesktopDeviceFileAccess::copyFile(const FilePath &filePath,
|
||||
const FilePath &target) const
|
||||
{
|
||||
if (QFile::copy(filePath.path(), target.path()))
|
||||
QFile srcFile(filePath.path());
|
||||
|
||||
if (srcFile.copy(target.path()))
|
||||
return {};
|
||||
return make_unexpected(Tr::tr("Failed to copy file \"%1\" to \"%2\".")
|
||||
.arg(filePath.toUserOutput(), target.toUserOutput()));
|
||||
return make_unexpected(
|
||||
Tr::tr("Failed to copy file \"%1\" to \"%2\": %3")
|
||||
.arg(filePath.toUserOutput(), target.toUserOutput(), srcFile.errorString()));
|
||||
}
|
||||
|
||||
bool DesktopDeviceFileAccess::renameFile(const FilePath &filePath, const FilePath &target) const
|
||||
|
Reference in New Issue
Block a user