Skip to content

Commit 298b97c

Browse files
authored
Use string match to find the suitable unity editor for the opening project (#36)
1 parent 1d73e38 commit 298b97c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

source/interface_derived.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,12 @@ void MainFrameDerived::OpenProject(const long& index){
381381
wxMessageBox("Cannot open project at " + p.path.string() + " because it could not be found.", "Cannot Open Project", wxOK | wxICON_ERROR);
382382
return;
383383
}
384-
385-
for (const auto& path : installPaths) {
386-
auto editorPath = path / p.version / executable;
387384

385+
for (const auto& editor : editors) {
386+
if (editor.name.find(p.version) == std::string::npos)
387+
continue;
388+
389+
auto editorPath = editor.executablePath();
388390
//check that the unity editor exists at that location
389391
if (filesystem::exists(editorPath)) {
390392

@@ -410,6 +412,7 @@ void MainFrameDerived::OpenProject(const long& index){
410412
}
411413
#endif
412414
}
415+
413416
// prompt the user to choose a new editor because we couldn't locate one
414417
wxCommandEvent evt;
415418
MainFrameDerived::OnOpenWith(evt);

0 commit comments

Comments
 (0)