aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/fileutils.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2021-06-28 13:57:10 +0200
committerhjk <[email protected]>2021-06-28 13:03:32 +0000
commit54b40229879d72ecf02b53dd4c3634eb90ffdf0e (patch)
treea7a3803192aca0fd6c559a270d82dbf58e76f616 /src/libs/utils/fileutils.cpp
parent782779f8f4d1b572c87ee9d984ccd698aee1cdd5 (diff)
Utils: Implement FilePath::rename()
And uses it in CMake's fileapi reader. Change-Id: I9e719aa4b253eaca17c6b304eab5e7268fcfab29 Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/libs/utils/fileutils.cpp')
-rw-r--r--src/libs/utils/fileutils.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp
index 46395830f33..9311801e069 100644
--- a/src/libs/utils/fileutils.cpp
+++ b/src/libs/utils/fileutils.cpp
@@ -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();