MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / isFileInProject

Method isFileInProject

context/ProjectUtils.cpp:13–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace QodeAssist::Context {
12
13bool 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
38QString ProjectUtils::findFileInProject(const QString &filename)
39{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected