Browse Source

Now tries to compile/compile and run even without files if a directory is open.

merge-requests/365/head
eidheim 10 years ago
parent
commit
914ed4b45a
  1. 22
      src/window.cc

22
src/window.cc

@ -432,9 +432,16 @@ void Window::set_menu_actions() {
});
menu->add_action("compile_and_run", [this]() {
if(notebook.get_current_page()==-1 || compiling)
if(compiling)
return;
CMake cmake(notebook.get_current_view()->file_path);
boost::filesystem::path cmake_path;
if(notebook.get_current_page()!=-1)
cmake_path=notebook.get_current_view()->file_path.parent_path();
else
cmake_path=Singleton::directories->current_path;
if(cmake_path.empty())
return;
CMake cmake(cmake_path);
auto executables = cmake.get_functions_parameters("add_executable");
boost::filesystem::path executable_path;
if(executables.size()>0 && executables[0].second.size()>0) {
@ -472,9 +479,16 @@ void Window::set_menu_actions() {
}
});
menu->add_action("compile", [this]() {
if(notebook.get_current_page()==-1 || compiling)
if(compiling)
return;
boost::filesystem::path cmake_path;
if(notebook.get_current_page()!=-1)
cmake_path=notebook.get_current_view()->file_path.parent_path();
else
cmake_path=Singleton::directories->current_path;
if(cmake_path.empty())
return;
CMake cmake(notebook.get_current_view()->file_path);
CMake cmake(cmake_path);
if(cmake.project_path!="") {
compiling=true;
Singleton::terminal->print("Compiling project "+cmake.project_path.string()+"\n");

Loading…
Cancel
Save