From 2ab2d9675338f5434936b315712539f4b01cd2c6 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 9 Aug 2021 08:53:40 +0200 Subject: Utils: Use FilePath in copy helpers Change-Id: I81b367a5851c0fbcdf45c63c5536c206845a8337 Reviewed-by: Christian Stenger --- src/plugins/cpptools/cpptoolstestcase.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/plugins/cpptools/cpptoolstestcase.cpp') diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp index 24e1373f4f..5efe6f8aff 100644 --- a/src/plugins/cpptools/cpptoolstestcase.cpp +++ b/src/plugins/cpptools/cpptoolstestcase.cpp @@ -322,20 +322,18 @@ static bool copyRecursively(const QString &sourceDirPath, const QString &targetDirPath, QString *error) { - auto copyHelper = [](QFileInfo sourceInfo, QFileInfo targetInfo, QString *error) -> bool { - const QString sourcePath = sourceInfo.absoluteFilePath(); - const QString targetPath = targetInfo.absoluteFilePath(); - if (!QFile::copy(sourcePath, targetPath)) { + auto copyHelper = [](const FilePath &sourcePath, const FilePath &targetPath, QString *error) -> bool { + if (!sourcePath.copyFile(targetPath)) { if (error) { *error = QString::fromLatin1("copyRecursively() failed: \"%1\" to \"%2\".") - .arg(sourcePath, targetPath); + .arg(sourcePath.toUserOutput(), targetPath.toUserOutput()); } return false; } // Copied files from Qt resources are read-only. Make them writable // so that their parent directory can be removed without warnings. - QFile file(targetPath); + QFile file(targetPath.toString()); return file.setPermissions(file.permissions() | QFile::WriteUser); }; -- cgit v1.2.1