forked from qt-creator/qt-creator
		
	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: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
		@@ -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()) {
 | 
			
		||||
        includeFile->deref();
 | 
			
		||||
 | 
			
		||||
    includeFile->deref();
 | 
			
		||||
    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,
 | 
			
		||||
                        QStringList(newName),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user