@@ -577,6 +577,8 @@ void MainFrameDerived::LoadEditorVersions(){
577
577
wxCommandEvent e;
578
578
OnSelectEditor (e);
579
579
editors.clear ();
580
+
581
+
580
582
581
583
// iterate over the search paths
582
584
for (auto & path : installPaths){
@@ -586,6 +588,19 @@ void MainFrameDerived::LoadEditorVersions(){
586
588
struct dirent *entry = readdir (dir);
587
589
// loop over the contents
588
590
wxArrayString a;
591
+ auto addInstall = [this ,&a,entry](const editor& e){
592
+ if (std::find (editors.begin (), editors.end (), e) == editors.end ()){
593
+ // get the target architecture
594
+ #if __APPLE
595
+ auto bundlepath = e.path / entry->d_name / " Unity.app" ;
596
+ auto arch = getArchitectureFromBundle (bundlepath.string ().c_str ());
597
+ #else
598
+
599
+ #endif
600
+ a.Add (e.name + " - " + e.path .string ());
601
+ editors.push_back (e);
602
+ }
603
+ };
589
604
while (entry != nullptr )
590
605
{
591
606
// is this a folder?
@@ -607,27 +622,15 @@ void MainFrameDerived::LoadEditorVersions(){
607
622
608
623
// add it to the backing datastructure
609
624
editor e = {buffer, path};
610
- if (std::find (editors.begin (), editors.end (), e) == editors.end ()){
611
- // get the target architecture
612
- auto bundlepath = path / entry->d_name / " Unity.app" ;
613
- auto arch = getArchitectureFromBundle (bundlepath.string ().c_str ());
614
-
615
- a.Add (e.name + " - " + e.path .string ());
616
- editors.push_back (e);
617
- }
625
+ addInstall (e);
618
626
}
619
627
}
620
628
else
621
629
#endif
622
630
{
623
631
// add it to the backing datastructure
624
632
editor e = {entry->d_name , path};
625
- if (std::find (editors.begin (), editors.end (), e) == editors.end ()){
626
- auto bundlepath = path / entry->d_name / " Unity.app" ;
627
- auto arch = getArchitectureFromBundle (bundlepath.string ().c_str ());
628
- a.Add (e.name + " - " + e.path .string ());
629
- editors.push_back (e);
630
- }
633
+ addInstall (e);
631
634
}
632
635
}
633
636
}
0 commit comments