forked from qt-creator/qt-creator
CppTools: Use project part ids instead of file paths
File paths are not unique since e.g. each qbs group in a file is mapped to a project part. Change-Id: I7df3f224dd23046b869f2588b8a34eb26cfc0b1a Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -218,16 +218,16 @@ ProjectPart::Ptr projectPartForFile(const QString &filePath)
|
||||
bool isProjectPartValid(const ProjectPart::Ptr projectPart)
|
||||
{
|
||||
if (projectPart)
|
||||
return CppModelManager::instance()->projectPartForProjectFile(projectPart->projectFile);
|
||||
return CppModelManager::instance()->projectPartForId(projectPart->id());
|
||||
return false;
|
||||
}
|
||||
|
||||
QString projectFilePathForFile(const QString &filePath)
|
||||
QString projectPartIdForFile(const QString &filePath)
|
||||
{
|
||||
const ProjectPart::Ptr projectPart = projectPartForFile(filePath);
|
||||
|
||||
if (isProjectPartValid(projectPart))
|
||||
return projectPart->projectFile; // OK, Project Part is still loaded
|
||||
return projectPart->id(); // OK, Project Part is still loaded
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user