ProjectExplorer: Support moving to different dir when renaming

... files in the project tree.

Fixes: QTCREATORBUG-15981
Change-Id: Id704ec0638046e2191638b59e0a597b984d4822a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2023-04-25 12:59:05 +02:00
parent 2d91be25f2
commit b024ebda0e

View File

@@ -170,8 +170,11 @@ bool FileUtils::renameFile(const FilePath &orgFilePath, const FilePath &newFileP
if (orgFilePath == newFilePath) if (orgFilePath == newFilePath)
return false; return false;
FilePath dir = orgFilePath.absolutePath(); const FilePath dir = orgFilePath.absolutePath();
IVersionControl *vc = VcsManager::findVersionControlForDirectory(dir); IVersionControl *vc = VcsManager::findVersionControlForDirectory(dir);
const FilePath newDir = newFilePath.absolutePath();
if (newDir != dir && !newDir.ensureWritableDir())
return false;
bool result = false; bool result = false;
if (vc && vc->supportsOperation(IVersionControl::MoveOperation)) if (vc && vc->supportsOperation(IVersionControl::MoveOperation))