Browse Source

Small change in setting and using Source::View::project_path.

merge-requests/365/head
eidheim 11 years ago
parent
commit
e7b6e425a0
  1. 6
      juci/source.cc

6
juci/source.cc

@ -181,7 +181,7 @@ get_autocomplete_suggestions(int line_number, int column) {
std::vector<std::string> Source::ClangView:: std::vector<std::string> Source::ClangView::
get_compilation_commands() { get_compilation_commands() {
clang::CompilationDatabase db(project_path+"/"); clang::CompilationDatabase db(project_path);
clang::CompileCommands commands(file_path, &db); clang::CompileCommands commands(file_path, &db);
std::vector<clang::CompileCommand> cmds = commands.get_commands(); std::vector<clang::CompileCommand> cmds = commands.get_commands();
std::vector<std::string> arguments; std::vector<std::string> arguments;
@ -408,9 +408,7 @@ Source::Controller::Controller(const Source::Config &config,
const std::string& file_path, std::string project_path) : const std::string& file_path, std::string project_path) :
config(config) { config(config) {
if(project_path=="") { if(project_path=="") {
size_t last_of=file_path.find_last_of("\\/"); project_path=boost::filesystem::path(file_path).parent_path().string();
if(last_of!=std::string::npos)
project_path=file_path.substr(0, last_of);
} }
if (config.legal_extension(file_path.substr(file_path.find_last_of(".") + 1))) if (config.legal_extension(file_path.substr(file_path.find_last_of(".") + 1)))
view=std::unique_ptr<View>(new ClangView(config, file_path, project_path)); view=std::unique_ptr<View>(new ClangView(config, file_path, project_path));

Loading…
Cancel
Save