@@ -395,23 +395,6 @@ void MainFrameDerived::OpenProject(const long& index){
395395 return ;
396396 }
397397 }
398- #if __APPLE__
399- for (const auto & path : installPaths) {
400- if (filesystem::exists (path / executable)) {
401- // mac unlabeled version
402- auto unlabeledPath = path / executable;
403- char buffer[16 ];
404- auto unlabeledPathInfo = path / " Unity.app" / " Contents" / " Info.plist" ;
405- getCFBundleVersionFromPlist (unlabeledPathInfo.string ().c_str (), buffer, sizeof (buffer));
406- if (p.version == buffer) {
407- string cmd = " \" " + unlabeledPath.string () + " \" -projectpath \" " + p.path .string () + " \" " ;
408- launch_process (cmd);
409- return ;
410- }
411- }
412- }
413- #endif
414-
415398
416399 // prompt the user to choose a new editor because we couldn't locate one
417400 wxCommandEvent evt;
@@ -445,7 +428,7 @@ const char* const PlatToStr(TargetPlatform plat) {
445428 @param e the editor version to use when opening the project
446429 */
447430void MainFrameDerived::OpenProject (const project& p, const editor& e, TargetPlatform plat){
448- string cmd = " \" " + (e. path / e. name / executable ).string () + " \" -projectpath \" " + p.path .string () + " \" " ;
431+ string cmd = " \" " + e. executablePath ( ).string () + " \" -projectpath \" " + p.path .string () + " \" " ;
449432 if (plat != TargetPlatform::CurrentPlatform) {
450433 auto str = PlatToStr (plat);
451434 cmd += fmt::format (" -buildTarget {}" , str);
@@ -595,8 +578,6 @@ void MainFrameDerived::LoadEditorVersions(){
595578 wxCommandEvent e;
596579 OnSelectEditor (e);
597580 editors.clear ();
598-
599-
600581
601582 // iterate over the search paths
602583 for (auto & path : installPaths){
@@ -630,38 +611,35 @@ void MainFrameDerived::LoadEditorVersions(){
630611 // is this a folder?
631612 if (dir_entry.is_directory ()){
632613 // does this folder have a valid executable inside?
633- auto p = path / entry.filename () / executable;
634- if (filesystem::exists (p)){
635- // add it to the list
614+
615+ // add it to the list
636616#if __APPLE__
637- // the Unity Download Assistant on Mac does not allow multiple
638- // unity versions at once, which sucks. To get the version,
639- // we need to parse the info.plist inside of Unity.app
640- auto pathstr = entry.filename ().string ();
641- if (pathstr == " ." ){
642- auto infopath = path / entry.filename () / " Unity.app" / " Contents" / " Info.plist" ;
643- if (filesystem::exists (infopath)){
644- // read the file and look for CFBundleVersion
645- char buffer[16 ]{0 };
646- getCFBundleVersionFromPlist (infopath.string ().c_str (), buffer, sizeof (buffer));
647-
648- // add it to the backing datastructure
649- editor e = {buffer, path};
650- addInstall (e);
651- }
652- }
653- else
654- #endif
655- {
656- // add it to the backing datastructure
657- editor e = {entry.filename (), path};
658- addInstall (e);
659- }
617+ // the Unity Download Assistant on Mac does not allow multiple
618+ // unity versions at once, which sucks. To get the version,
619+ // we need to parse the info.plist inside of Unity.app
620+ auto infopath = entry / " Unity.app" / " Contents" / " Info.plist" ;
621+ if (filesystem::exists (infopath)){
622+ // read the file and look for CFBundleVersion
623+ char buffer[16 ]{0 };
624+ getCFBundleVersionFromPlist (infopath.string ().c_str (), buffer, sizeof (buffer));
625+
626+ // add it to the backing datastructure
627+ editor e = {buffer, entry};
628+ addInstall (e);
660629 }
630+ #else
631+ auto p = entry / executable;
632+ if (filesystem::exists (p)){
633+ // add it to the backing datastructure
634+ editor e = {entry.filename (), p};
635+ addInstall (e);
636+ }
637+ #endif
661638 }
662639
663640 installsList->Append (a);
664641 }
642+
665643 }
666644}
667645
0 commit comments