MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / getPrecompiledDir

Method getPrecompiledDir

src/Common/PlatformFileSystem.cpp:441–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439}
440
441PathId PlatformFileSystem::getPrecompiledDir(PathId programId,
442 SymbolTable *symbolTable) {
443 if (!programId) return BadPathId;
444
445 const std::filesystem::path programFile = toPath(programId);
446 if (programFile.empty() || !programFile.has_parent_path()) return BadPathId;
447
448 const std::filesystem::path programPath = programFile.parent_path();
449 const std::vector<std::filesystem::path> search_paths = {
450 programPath, // Build path
451 programPath / ".." / "share" / "surelog", // Install path
452 };
453
454 std::error_code ec;
455 for (const std::filesystem::path &dir : search_paths) {
456 const std::filesystem::path pkgDir = dir / kPrecompiledDirName;
457 if ((std::filesystem::exists(dir, ec) && !ec) &&
458 (std::filesystem::is_directory(pkgDir, ec) && !ec)) {
459 PathId precompiledDirId = toPathId(pkgDir.string(), symbolTable);
460 if (kEnableLogs) {
461 std::cerr << "getPrecompiledDir: " << PathIdPP(programId) << " => "
462 << PathIdPP(precompiledDirId) << std::endl;
463 }
464 return precompiledDirId;
465 }
466 }
467
468 return toPathId((programPath / kPrecompiledDirName).string(), symbolTable);
469}
470
471std::filesystem::path PlatformFileSystem::getPrecompiledDir(
472 SymbolTable *symbolTable) {

Callers 1

parseCommandLineMethod · 0.80

Calls 1

PathIdPPClass · 0.85

Tested by

no test coverage detected