Utils: Fix copyFile to include permissions

Also adds line breaks to info output.

Change-Id: I314ab87a47d7bd7541acb6a1553238fcfc27099d
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-10-25 13:52:04 +02:00
parent b9062e9c80
commit d46a079744
2 changed files with 12 additions and 3 deletions

View File

@@ -1264,7 +1264,16 @@ bool FilePath::copyFile(const FilePath &target) const
const std::optional<QByteArray> ba = fileContents();
if (!ba)
return false;
return target.writeFileContents(*ba);
const auto perms = permissions();
if (!target.writeFileContents(*ba))
return false;
if (!target.setPermissions(perms)) {
target.removeFile();
return false;
}
return true;
}
return fileAccess()->copyFile(*this, target);
}