Browse Source

Further improvements to libclang's resource path

merge-requests/413/head
eidheim 3 years ago
parent
commit
70b01ba867
  1. 12
      src/compile_commands.cpp

12
src/compile_commands.cpp

@ -87,8 +87,10 @@ std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem:
#if defined(__APPLE__) #if defined(__APPLE__)
static auto resource_path = []() -> std::string { static auto resource_path = []() -> std::string {
boost::system::error_code ec; boost::system::error_code ec;
for(boost::filesystem::directory_iterator it(boost::filesystem::path(LIBCLANG_LIBRARY_DIR) / "clang", ec), end; it != end; ++it) for(boost::filesystem::directory_iterator it(boost::filesystem::path(LIBCLANG_LIBRARY_DIR) / "clang", ec), end; it != end; ++it) {
return it->path().string(); if(boost::filesystem::is_directory(it->path() / "include", ec))
return it->path().string();
}
return {}; return {};
}(); }();
if(!resource_path.empty()) { if(!resource_path.empty()) {
@ -119,8 +121,10 @@ std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem:
} }
else { else {
boost::system::error_code ec; boost::system::error_code ec;
for(boost::filesystem::directory_iterator it(boost::filesystem::path(LIBCLANG_LIBRARY_DIR) / "clang", ec), end; it != end; ++it) for(boost::filesystem::directory_iterator it(boost::filesystem::path(LIBCLANG_LIBRARY_DIR) / "clang", ec), end; it != end; ++it) {
return it->path().string(); if(boost::filesystem::is_directory(it->path() / "include", ec))
return it->path().string();
}
} }
return {}; return {};
}(); }();

Loading…
Cancel
Save