Skip to content

Commit

Permalink
Use string match to find the suitable unity editor for the opening pr…
Browse files Browse the repository at this point in the history
…oject (#36)
  • Loading branch information
jim-kirisame committed Nov 10, 2023
1 parent 1d73e38 commit 298b97c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/interface_derived.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,12 @@ void MainFrameDerived::OpenProject(const long& index){
wxMessageBox("Cannot open project at " + p.path.string() + " because it could not be found.", "Cannot Open Project", wxOK | wxICON_ERROR);
return;
}

for (const auto& path : installPaths) {
auto editorPath = path / p.version / executable;

for (const auto& editor : editors) {
if (editor.name.find(p.version) == std::string::npos)
continue;

auto editorPath = editor.executablePath();
//check that the unity editor exists at that location
if (filesystem::exists(editorPath)) {

Expand All @@ -410,6 +412,7 @@ void MainFrameDerived::OpenProject(const long& index){
}
#endif
}

// prompt the user to choose a new editor because we couldn't locate one
wxCommandEvent evt;
MainFrameDerived::OnOpenWith(evt);
Expand Down

0 comments on commit 298b97c

Please sign in to comment.