From 54b40229879d72ecf02b53dd4c3634eb90ffdf0e Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 28 Jun 2021 13:57:10 +0200 Subject: Utils: Implement FilePath::rename() And uses it in CMake's fileapi reader. Change-Id: I9e719aa4b253eaca17c6b304eab5e7268fcfab29 Reviewed-by: David Schulz --- src/libs/utils/fileutils.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libs/utils/fileutils.cpp') 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(); -- cgit v1.2.3