Browse Source

Added NULL check for getenv in MSYS2

merge-requests/365/head
U-olece-PC\olece 10 years ago
parent
commit
47318febd5
  1. 8
      src/config.cc
  2. 1
      src/source_clang.cc

8
src/config.cc

@ -28,10 +28,14 @@ Config::Config() {
}
#ifdef _WIN32
terminal.msys2_mingw_path=boost::filesystem::path(std::getenv("WD")).parent_path().parent_path().parent_path();
std::string msystem=std::getenv("MSYSTEM");
auto env_WD=std::getenv("WD");
auto env_MSYSTEM=std::getenv("MSYSTEM");
if(env_WD!=NULL && env_MSYSTEM!=NULL) {
terminal.msys2_mingw_path=boost::filesystem::path(env_WD).parent_path().parent_path().parent_path();
std::string msystem=env_MSYSTEM;
std::transform(msystem.begin(), msystem.end(), msystem.begin(), ::tolower);
terminal.msys2_mingw_path/=msystem;
}
#endif
}

1
src/source_clang.cc

@ -200,6 +200,7 @@ std::vector<std::string> Source::ClangViewParse::get_compilation_commands() {
arguments.emplace_back("-I/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1"); //Added for OS X 10.11
#endif
#ifdef _WIN32
if(!Config::get().terminal.msys2_mingw_path.empty())
arguments.emplace_back("-I"+(Config::get().terminal.msys2_mingw_path/"lib/clang"/clang_version/"include").string());
#endif
}

Loading…
Cancel
Save