Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
Folder now also identified as Rust build if Cargo files are found
Browse files Browse the repository at this point in the history
  • Loading branch information
eidheim committed Jan 18, 2018
1 parent 139967f commit aa7b082
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/project.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ std::shared_ptr<Project::Base> Project::create() {
return std::shared_ptr<Project::Base>(new Project::JavaScript(std::move(build)));
if(language_id=="html")
return std::shared_ptr<Project::Base>(new Project::HTML(std::move(build)));
if(language_id=="rust")
return std::shared_ptr<Project::Base>(new Project::Rust(std::move(build)));
}
}
else
build=Build::create(Directories::get().path);

if(dynamic_cast<CMakeBuild*>(build.get()) || dynamic_cast<MesonBuild*>(build.get()))
return std::shared_ptr<Project::Base>(new Project::Clang(std::move(build)));
else if(dynamic_cast<CargoBuild*>(build.get()))
return std::shared_ptr<Project::Base>(new Project::Rust(std::move(build)));
else
return std::shared_ptr<Project::Base>(new Project::Base(std::move(build)));
}
Expand Down Expand Up @@ -783,15 +783,15 @@ void Project::HTML::compile_and_run() {
void Project::Rust::compile() {
std::string command=build->get_compile_command();
Terminal::get().print("Running "+command+"\n");
Terminal::get().async_process(command, Notebook::get().get_current_view()->file_path.parent_path(), [command](int exit_status) {
Terminal::get().async_process(command, build->project_path, [command](int exit_status) {
Terminal::get().async_print(command+" returned: "+std::to_string(exit_status)+'\n');
});
}

void Project::Rust::compile_and_run() {
std::string command="cargo run";
Terminal::get().print("Running "+command+"\n");
Terminal::get().async_process(command, Notebook::get().get_current_view()->file_path.parent_path(), [command](int exit_status) {
Terminal::get().async_process(command, build->project_path, [command](int exit_status) {
Terminal::get().async_print(command+" returned: "+std::to_string(exit_status)+'\n');
});
}

0 comments on commit aa7b082

Please sign in to comment.