@@ -195,26 +195,37 @@ void MainFrameDerived::OnAbout(wxCommandEvent& event)
195195}
196196
197197void MainFrameDerived::OnAddProject (wxCommandEvent& event){
198- string msg =" Select the folder containing the Unity Project" ;
199- string path = GetPathFromDialog (msg);
200- if (path != " " ){
201- // check that the project does not already exist
202- for (project& p : projects){
203- if (p.path == path){
204- wxMessageBox ( " This project has already been added." , " Cannot add project" , wxOK | wxICON_WARNING );
205- return ;
206- }
207- }
208-
209- // add it to the projects list
210- try {
211- project p = LoadProject (path);
212- AddProject (p," " );
213- }
214- catch (runtime_error& e){
215- wxMessageBox (e.what ()," Unable to add project" ,wxOK | wxICON_ERROR);
216- }
217- }
198+ auto msg =" Select the folder(s) containing the Unity Project" ;
199+
200+ wxDirDialog dlg (NULL , msg, " " , wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST | wxDD_MULTIPLE);
201+ if (dlg.ShowModal () == wxID_CANCEL) {
202+ return string (" " );
203+ }
204+ // get the path and return the standard string version
205+ wxArrayString paths;
206+ dlg.GetPaths (paths);
207+
208+ for (const auto & p : paths){
209+ auto path = p.ToStdString ();
210+ if (path != " " ){
211+ // check that the project does not already exist
212+ for (project& p : projects){
213+ if (p.path == path){
214+ wxMessageBox ( " This project has already been added." , " Cannot add project" , wxOK | wxICON_WARNING );
215+ return ;
216+ }
217+ }
218+
219+ // add it to the projects list
220+ try {
221+ project p = LoadProject (path);
222+ AddProject (p," " );
223+ }
224+ catch (runtime_error& e){
225+ wxMessageBox (e.what ()," Unable to add project" ,wxOK | wxICON_ERROR);
226+ }
227+ }
228+ }
218229}
219230
220231/* *
0 commit comments