Skip to content

Commit 81a51bc

Browse files
committed
apply repo-root to database path
1 parent a6d069e commit 81a51bc

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • cpp-linter/src/clang_tools

cpp-linter/src/clang_tools/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,15 @@ pub async fn capture_clang_tools_output(
140140

141141
// parse database (if provided) to match filenames when parsing clang-tidy's stdout
142142
if let Some(db_path) = &clang_params.database
143-
&& let Ok(db_str) = fs::read(db_path.join("compile_commands.json"))
143+
&& let Ok(db_str) = fs::read(
144+
if db_path.is_relative() {
145+
clang_params.repo_root.join(db_path)
146+
} else {
147+
db_path.to_path_buf()
148+
}
149+
.join(db_path)
150+
.join("compile_commands.json"),
151+
)
144152
{
145153
clang_params.database_json = Some(
146154
// A compilation database should be UTF-8 encoded, but file paths are not; use lossy conversion.

0 commit comments

Comments
 (0)