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);
|
||||
}
|
||||
|
@@ -1458,7 +1458,7 @@ private:
|
||||
|
||||
const FilePath targetDir = target.parentDir();
|
||||
if (!m_checkedDirectories.contains(targetDir)) {
|
||||
emit progress(tr("Creating directory: %1")
|
||||
emit progress(tr("Creating directory: %1\n")
|
||||
.arg(targetDir.toUserOutput()));
|
||||
if (!targetDir.ensureWritableDir()) {
|
||||
result.m_errorString = tr("Failed.");
|
||||
@@ -1469,7 +1469,7 @@ private:
|
||||
m_checkedDirectories.insert(targetDir);
|
||||
}
|
||||
|
||||
emit progress(tr("Copying %1/%2: %3 -> %4")
|
||||
emit progress(tr("Copying %1/%2: %3 -> %4\n")
|
||||
.arg(m_currentIndex).arg(m_fileCount).arg(source.toUserOutput(), target.toUserOutput()));
|
||||
if (!source.copyFile(target)) {
|
||||
result.m_errorString = tr("Failed.");
|
||||
|
Reference in New Issue
Block a user