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

Commit aa7b082

Browse files
committed
Folder now also identified as Rust build if Cargo files are found
1 parent 139967f commit aa7b082

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/project.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ std::shared_ptr<Project::Base> Project::create() {
146146
return std::shared_ptr<Project::Base>(new Project::JavaScript(std::move(build)));
147147
if(language_id=="html")
148148
return std::shared_ptr<Project::Base>(new Project::HTML(std::move(build)));
149-
if(language_id=="rust")
150-
return std::shared_ptr<Project::Base>(new Project::Rust(std::move(build)));
151149
}
152150
}
153151
else
154152
build=Build::create(Directories::get().path);
155153

156154
if(dynamic_cast<CMakeBuild*>(build.get()) || dynamic_cast<MesonBuild*>(build.get()))
157155
return std::shared_ptr<Project::Base>(new Project::Clang(std::move(build)));
156+
else if(dynamic_cast<CargoBuild*>(build.get()))
157+
return std::shared_ptr<Project::Base>(new Project::Rust(std::move(build)));
158158
else
159159
return std::shared_ptr<Project::Base>(new Project::Base(std::move(build)));
160160
}
@@ -783,15 +783,15 @@ void Project::HTML::compile_and_run() {
783783
void Project::Rust::compile() {
784784
std::string command=build->get_compile_command();
785785
Terminal::get().print("Running "+command+"\n");
786-
Terminal::get().async_process(command, Notebook::get().get_current_view()->file_path.parent_path(), [command](int exit_status) {
786+
Terminal::get().async_process(command, build->project_path, [command](int exit_status) {
787787
Terminal::get().async_print(command+" returned: "+std::to_string(exit_status)+'\n');
788788
});
789789
}
790790

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

0 commit comments

Comments
 (0)