MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / resolveCppIncludePath

Function resolveCppIncludePath

src/resolution/import-resolver.ts:511–531  ·  view source on GitHub ↗

* Resolve a C/C++ include path by searching include directories. * Called as a fallback after relative and aliased resolution fail.

(
  importPath: string,
  language: Language,
  context: ResolutionContext
)

Source from the content-addressed store, hash-verified

509 * Called as a fallback after relative and aliased resolution fail.
510 */
511function resolveCppIncludePath(
512 importPath: string,
513 language: Language,
514 context: ResolutionContext
515): string | null {
516 const includeDirs = context.getCppIncludeDirs?.() ?? [];
517 const extensions = EXTENSION_RESOLUTION[language] ?? [];
518
519 for (const dir of includeDirs) {
520 const normalizedDir = dir.replace(/\\/g, '/');
521 for (const ext of extensions) {
522 const candidate = normalizedDir + '/' + importPath + ext;
523 if (context.fileExists(candidate)) return candidate;
524 }
525 // Try as-is (already has extension)
526 const candidate = normalizedDir + '/' + importPath;
527 if (context.fileExists(candidate)) return candidate;
528 }
529
530 return null;
531}
532
533/**
534 * Is this reference a PHP include/require PATH (vs a namespace `use` symbol)?

Callers 1

resolveImportPathFunction · 0.85

Calls 2

getCppIncludeDirsMethod · 0.80
fileExistsMethod · 0.80

Tested by

no test coverage detected