forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user