|
18 | 18 |
|
19 | 19 | #include <fmt/format.h> |
20 | 20 | #include <filesystem> |
| 21 | +#if __APPLE__ |
| 22 | +#include "AppleUtilities.h" |
| 23 | +#endif |
21 | 24 | using namespace std; |
22 | 25 | using namespace std::filesystem; |
23 | 26 |
|
@@ -495,11 +498,33 @@ void MainFrameDerived::LoadEditorVersions(){ |
495 | 498 | auto p = path / entry->d_name / executable; |
496 | 499 | if (filesystem::exists(p)){ |
497 | 500 | //add it to the list |
498 | | - a.Add(string(entry->d_name) + " - " + path.string()); |
499 | | - |
500 | | - //add it to the backing datastructure |
501 | | - editor e = {entry->d_name, path}; |
502 | | - editors.push_back(e); |
| 501 | +#if __APPLE__ |
| 502 | + // the Unity Download Assistant on Mac does not allow multiple |
| 503 | + // unity versions at once, which sucks. To get the version, |
| 504 | + // we need to parse the info.plist inside of Unity.app |
| 505 | + if (strcmp(entry->d_name, ".") == 0){ |
| 506 | + auto infopath = path / entry->d_name / "Unity.app" / "Contents" / "Info.plist"; |
| 507 | + if (filesystem::exists(infopath)){ |
| 508 | + // read the file and look for CFBundleVersion |
| 509 | + char buffer[16]; |
| 510 | + getCFBundleVersionFromPlist(infopath.string().c_str(), buffer, sizeof(buffer)); |
| 511 | + |
| 512 | + a.Add(string(buffer) + " - " + path.string()); |
| 513 | + //add it to the backing datastructure |
| 514 | + editor e = {buffer, path}; |
| 515 | + |
| 516 | + editors.push_back(e); |
| 517 | + } |
| 518 | + } |
| 519 | + else |
| 520 | +#endif |
| 521 | + { |
| 522 | + a.Add(string(entry->d_name) + " - " + path.string()); |
| 523 | + //add it to the backing datastructure |
| 524 | + editor e = {entry->d_name, path}; |
| 525 | + |
| 526 | + editors.push_back(e); |
| 527 | + } |
503 | 528 | } |
504 | 529 | } |
505 | 530 | entry = readdir(dir); |
|
0 commit comments