Utils: add rename function to fileutils

Change-Id: Iaf47744819c21013661e3bd0275a04c1d68e9023
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
David Schulz
2021-06-11 14:33:58 +02:00
parent 410b02f8c5
commit 3b127c04e8
2 changed files with 8 additions and 0 deletions

View File

@@ -485,6 +485,13 @@ FilePath FileUtils::homePath()
return FilePath::fromString(QDir::cleanPath(QDir::homePath()));
}
bool FileUtils::renameFile(const FilePath &srcFilePath, const FilePath &tgtFilePath)
{
QTC_ASSERT(!srcFilePath.needsDevice(), return false);
QTC_ASSERT(srcFilePath.scheme() == tgtFilePath.scheme(), return false);
return QFile::rename(srcFilePath.path(), tgtFilePath.path());
}
QByteArray FileReader::fetchQrc(const QString &fileName)
{
QTC_ASSERT(fileName.startsWith(':'), return QByteArray());