Utils: Implement FilePath::rename()

And uses it in CMake's fileapi reader.

Change-Id: I9e719aa4b253eaca17c6b304eab5e7268fcfab29
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-06-28 13:57:10 +02:00
parent 782779f8f4
commit 54b4022987
8 changed files with 45 additions and 2 deletions

View File

@@ -1415,6 +1415,15 @@ bool FilePath::copyFile(const FilePath &target) const
return QFile::copy(path(), target.path());
}
bool FilePath::renameFile(const FilePath &target) const
{
if (needsDevice()) {
QTC_ASSERT(s_deviceHooks.renameFile, return false);
return s_deviceHooks.renameFile(*this, target);
}
return QFile::rename(path(), target.path());
}
QTextStream &operator<<(QTextStream &s, const FilePath &fn)
{
return s << fn.toString();