| 11 | namespace QodeAssist::Context { |
| 12 | |
| 13 | bool ProjectUtils::isFileInProject(const QString &filePath) |
| 14 | { |
| 15 | QList<ProjectExplorer::Project *> projects = ProjectExplorer::ProjectManager::projects(); |
| 16 | Utils::FilePath targetPath = Utils::FilePath::fromString(filePath); |
| 17 | |
| 18 | for (auto project : projects) { |
| 19 | if (!project) |
| 20 | continue; |
| 21 | |
| 22 | Utils::FilePaths projectFiles = project->files(ProjectExplorer::Project::SourceFiles); |
| 23 | for (const auto &projectFile : std::as_const(projectFiles)) { |
| 24 | if (projectFile == targetPath) { |
| 25 | return true; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | Utils::FilePath projectDir = project->projectDirectory(); |
| 30 | if (targetPath.isChildOf(projectDir)) { |
| 31 | return true; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | QString ProjectUtils::findFileInProject(const QString &filename) |
| 39 | { |
nothing calls this directly
no outgoing calls
no test coverage detected