mirror of
https://github.com/MaskRay/ccls.git
synced 2025-03-30 21:42:12 +00:00
Fix compile_commands.json parsing when filename is absolute.
Some compile_commands.json generators will emit absolute paths for the filename, such as cmake.
This commit is contained in:
parent
f48f818f4c
commit
1f0c1e922f
@ -272,7 +272,11 @@ std::vector<Project::Entry> LoadCompilationEntriesFromDirectory(
|
|||||||
clang_time.Pause(); // TODO: don't call clang::ToString in this block.
|
clang_time.Pause(); // TODO: don't call clang::ToString in this block.
|
||||||
|
|
||||||
our_time.Resume();
|
our_time.Resume();
|
||||||
std::string absolute_filename = directory + "/" + relative_filename;
|
std::string absolute_filename;
|
||||||
|
if (!relative_filename.empty() && relative_filename[0] == '/')
|
||||||
|
absolute_filename = relative_filename;
|
||||||
|
else
|
||||||
|
absolute_filename = directory + "/" + relative_filename;
|
||||||
entry.file = NormalizePathWithTestOptOut(absolute_filename);
|
entry.file = NormalizePathWithTestOptOut(absolute_filename);
|
||||||
entry.directory = directory;
|
entry.directory = directory;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user