forked from qt-creator/qt-creator
CMakePM: Do not hang on renaming files in parent directories
This fixes renaming of "my/class.cpp my/class.h" via "../class.h" and resulting into "class.cpp class.h". "oldRelPathName" was not needed since it was saved in the "m_filesToBeRenamed" map and it was computed from the new filename. This was prone to error. Task-number: QTCREATORBUG-30830 Change-Id: I839fab3bd6a6172f5ebfbaf9a4b6501cd5693fa8 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -936,10 +936,6 @@ bool CMakeBuildSystem::renameFile(Node *context,
|
||||
const FilePath newRelPath = newFilePath.canonicalPath().relativePathFrom(projDir).cleanPath();
|
||||
const QString newRelPathName = newRelPath.toString();
|
||||
|
||||
// FilePath needs the file to exist on disk, the old file has already been renamed
|
||||
const QString oldRelPathName
|
||||
= newRelPath.parentDir().pathAppended(oldFilePath.fileName()).cleanPath().toString();
|
||||
|
||||
const QString targetName = n->buildKey();
|
||||
const QString key
|
||||
= QStringList{projDir.path(), targetName, oldFilePath.path(), newFilePath.path()}.join(
|
||||
@@ -984,7 +980,7 @@ bool CMakeBuildSystem::renameFile(Node *context,
|
||||
}
|
||||
|
||||
// Try the next occurrence. This can happen if set_source_file_properties is used
|
||||
fileToRename = projectFileArgumentPosition(targetName, oldRelPathName);
|
||||
fileToRename = projectFileArgumentPosition(targetName, fileToRename->relativeFileName);
|
||||
} while (fileToRename && !fileToRename->fromGlobbing);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user