Browse Source

Minor fixes to build path error handling

merge-requests/365/head
eidheim 10 years ago
parent
commit
7e7589efac
  1. 2
      src/cmake.cc
  2. 9
      src/window.cc

2
src/cmake.cc

@ -59,7 +59,7 @@ boost::filesystem::path CMake::get_default_build_path(const boost::filesystem::p
boost::system::error_code ec; boost::system::error_code ec;
boost::filesystem::create_directories(default_build_path, ec); boost::filesystem::create_directories(default_build_path, ec);
if(ec) { if(ec) {
Terminal::get().print("Error: could not create "+default_build_path.string()+": "+ec.message(), true); Terminal::get().print("Error: could not create "+default_build_path.string()+": "+ec.message()+"\n", true);
return boost::filesystem::path(); return boost::filesystem::path();
} }
} }

9
src/window.cc

@ -539,9 +539,11 @@ void Window::set_menu_actions() {
if(cmake.project_path!="") { if(cmake.project_path!="") {
if(executable_path!="") { if(executable_path!="") {
compiling=true;
auto project_path=cmake.project_path; auto project_path=cmake.project_path;
auto default_build_path=CMake::get_default_build_path(project_path); auto default_build_path=CMake::get_default_build_path(project_path);
if(default_build_path.empty())
return;
compiling=true;
auto executable_path_string=executable_path.string(); auto executable_path_string=executable_path.string();
size_t pos=executable_path_string.find(project_path.string()); size_t pos=executable_path_string.find(project_path.string());
if(pos!=std::string::npos) { if(pos!=std::string::npos) {
@ -586,9 +588,12 @@ void Window::set_menu_actions() {
return; return;
CMake cmake(cmake_path); CMake cmake(cmake_path);
if(cmake.project_path!="") { if(cmake.project_path!="") {
auto default_build_path=CMake::get_default_build_path(cmake.project_path);
if(default_build_path.empty())
return;
compiling=true; compiling=true;
Terminal::get().print("Compiling project "+cmake.project_path.string()+"\n"); Terminal::get().print("Compiling project "+cmake.project_path.string()+"\n");
Terminal::get().async_process(Config::get().terminal.make_command, CMake::get_default_build_path(cmake.project_path), [this](int exit_status){ Terminal::get().async_process(Config::get().terminal.make_command, default_build_path, [this](int exit_status){
compiling=false; compiling=false;
}); });
} }

Loading…
Cancel
Save