From 03263c85217dd0cfddff73b966cd2d5cd8245d9d Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 16 Aug 2019 19:34:11 -0700 Subject: [PATCH] project: allow absolute compilationDatabaseDirectory Fix #466 --- src/project.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/project.cc b/src/project.cc index 25fdb6fa..bbe3f156 100644 --- a/src/project.cc +++ b/src/project.cc @@ -363,8 +363,12 @@ void Project::LoadDirectory(const std::string &root, Project::Folder &folder) { folder.entries.clear(); if (g_config->compilationDatabaseCommand.empty()) { CDBDir = root; - if (g_config->compilationDatabaseDirectory.size()) - sys::path::append(CDBDir, g_config->compilationDatabaseDirectory); + if (g_config->compilationDatabaseDirectory.size()) { + if (sys::path::is_absolute(g_config->compilationDatabaseDirectory)) + CDBDir = g_config->compilationDatabaseDirectory; + else + sys::path::append(CDBDir, g_config->compilationDatabaseDirectory); + } sys::path::append(Path, CDBDir, "compile_commands.json"); } else { // If `compilationDatabaseCommand` is specified, execute it to get the