Browse Source

Info message cleanup/fixes in project* files

merge-requests/365/head
eidheim 10 years ago
parent
commit
9dfd4dfaf3
  1. 49
      src/project.cc
  2. 10
      src/project.h
  3. 5
      src/project_build.cc

49
src/project.cc

@ -9,6 +9,7 @@
#ifdef JUCI_ENABLE_DEBUG #ifdef JUCI_ENABLE_DEBUG
#include "debug_clang.h" #include "debug_clang.h"
#endif #endif
#include "info.h"
boost::filesystem::path Project::debug_last_stop_file_path; boost::filesystem::path Project::debug_last_stop_file_path;
std::unordered_map<std::string, std::string> Project::run_arguments; std::unordered_map<std::string, std::string> Project::run_arguments;
@ -132,8 +133,31 @@ std::unique_ptr<Project::Base> Project::create() {
return std::unique_ptr<Project::Base>(new Project::Base(std::move(build))); return std::unique_ptr<Project::Base>(new Project::Base(std::move(build)));
} }
std::pair<std::string, std::string> Project::Base::get_run_arguments() {
Info::get().print("Could not find a supported project");
return {"", ""};
}
void Project::Base::compile() {
Info::get().print("Could not find a supported project");
}
void Project::Base::compile_and_run() {
Info::get().print("Could not find a supported project");
}
std::pair<std::string, std::string> Project::Base::debug_get_run_arguments() {
Info::get().print("Could not find a supported project");
return {"", ""};
}
void Project::Base::debug_start() {
Info::get().print("Could not find a supported project");
}
std::pair<std::string, std::string> Project::Clang::get_run_arguments() { std::pair<std::string, std::string> Project::Clang::get_run_arguments() {
if(build->get_default_path().empty() || !build->update_default()) auto build_path=build->get_default_path();
if(build_path.empty())
return {"", ""}; return {"", ""};
auto project_path=build->project_path.string(); auto project_path=build->project_path.string();
@ -146,13 +170,9 @@ std::pair<std::string, std::string> Project::Clang::get_run_arguments() {
auto executable=build->get_executable(Notebook::get().get_current_page()!=-1?Notebook::get().get_current_view()->file_path:"").string(); auto executable=build->get_executable(Notebook::get().get_current_page()!=-1?Notebook::get().get_current_view()->file_path:"").string();
if(executable!="") { if(executable!="") {
auto project_path=build->project_path; size_t pos=executable.find(project_path);
auto build_path=build->get_default_path(); if(pos!=std::string::npos)
if(!build_path.empty()) { executable.replace(pos, project_path.size(), build_path.string());
size_t pos=executable.find(project_path.string());
if(pos!=std::string::npos)
executable.replace(pos, project_path.string().size(), build_path.string());
}
arguments=filesystem::escape_argument(executable); arguments=filesystem::escape_argument(executable);
} }
else else
@ -219,7 +239,8 @@ void Project::Clang::compile_and_run() {
#ifdef JUCI_ENABLE_DEBUG #ifdef JUCI_ENABLE_DEBUG
std::pair<std::string, std::string> Project::Clang::debug_get_run_arguments() { std::pair<std::string, std::string> Project::Clang::debug_get_run_arguments() {
if(build->get_default_path().empty() || !build->update_default()) auto build_path=build->get_debug_path();
if(build_path.empty())
return {"", ""}; return {"", ""};
auto project_path=build->project_path.string(); auto project_path=build->project_path.string();
@ -232,13 +253,9 @@ std::pair<std::string, std::string> Project::Clang::debug_get_run_arguments() {
auto executable=build->get_executable(Notebook::get().get_current_page()!=-1?Notebook::get().get_current_view()->file_path:"").string(); auto executable=build->get_executable(Notebook::get().get_current_page()!=-1?Notebook::get().get_current_view()->file_path:"").string();
if(executable!="") { if(executable!="") {
auto project_path=build->project_path; size_t pos=executable.find(project_path);
auto build_path=build->get_debug_path(); if(pos!=std::string::npos)
if(!build_path.empty()) { executable.replace(pos, project_path.size(), build_path.string());
size_t pos=executable.find(project_path.string());
if(pos!=std::string::npos)
executable.replace(pos, project_path.string().size(), build_path.string());
}
arguments=filesystem::escape_argument(executable); arguments=filesystem::escape_argument(executable);
} }
else else

10
src/project.h

@ -32,13 +32,13 @@ namespace Project {
std::unique_ptr<Build> build; std::unique_ptr<Build> build;
virtual std::pair<std::string, std::string> get_run_arguments() {return {"", ""};} virtual std::pair<std::string, std::string> get_run_arguments();
virtual void compile() {} virtual void compile();
virtual void compile_and_run() {} virtual void compile_and_run();
virtual std::pair<std::string, std::string> debug_get_run_arguments() {return {"", ""};} virtual std::pair<std::string, std::string> debug_get_run_arguments();
Tooltips debug_variable_tooltips; Tooltips debug_variable_tooltips;
virtual void debug_start() {} virtual void debug_start();
virtual void debug_continue() {} virtual void debug_continue() {}
virtual void debug_stop() {} virtual void debug_stop() {}
virtual void debug_kill() {} virtual void debug_kill() {}

5
src/project_build.cc

@ -1,15 +1,12 @@
#include "project_build.h" #include "project_build.h"
#include "config.h" #include "config.h"
#include "info.h"
std::unique_ptr<Project::Build> Project::Build::create(const boost::filesystem::path &path) { std::unique_ptr<Project::Build> Project::Build::create(const boost::filesystem::path &path) {
std::unique_ptr<Project::Build> cmake(new CMakeBuild(path)); std::unique_ptr<Project::Build> cmake(new CMakeBuild(path));
if(!cmake->project_path.empty()) if(!cmake->project_path.empty())
return cmake; return cmake;
else { else
Info::get().print("Could not find a supported project");
return std::unique_ptr<Project::Build>(new Project::Build()); return std::unique_ptr<Project::Build>(new Project::Build());
}
} }
boost::filesystem::path Project::Build::get_default_path() { boost::filesystem::path Project::Build::get_default_path() {

Loading…
Cancel
Save