Commit 1323956f authored by Tobias Hunger's avatar Tobias Hunger
Browse files

QmakeNodes: Fix renaming of files

We need to re-parse the file after removing the old filename. Otherwise
we only hit the right spot by accident when adding the new filename.

Task-number: QTCREATORBUG-15241
Change-Id: I2e72da9f14033cc757a8b51d2ce1f5c2a5e5b557
Reviewed-by: default avatarOswald Buddenhagen <>
Reviewed-by: default avatarTobias Hunger <>
parent 0d849b9f
......@@ -1267,10 +1267,16 @@ bool QmakePriFileNode::renameFile(const QString &oldName,
QDir priFileDir = QDir(m_qmakeProFileNode->m_projectDir);
QStringList notChanged = ProWriter::removeFiles(includeFile, &lines, priFileDir,
QStringList(oldName), varNamesForRemoving());
if (!notChanged.isEmpty()) {
if (!notChanged.isEmpty())
return false;
// We need to re-parse here: The file has changed.
QMakeParser parser(0, 0, 0);
includeFile = parser.parsedProBlock(lines.join(QLatin1Char('\n')),
m_projectFilePath.toString(), 1, QMakeParser::FullGrammar);
QTC_ASSERT(includeFile, return false); // The file should still be valid after what we did.
ProWriter::addFiles(includeFile, &lines,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment