diff --git a/source/create_dialog_derived.cpp b/source/create_dialog_derived.cpp index 59b2b18b..7deb2a6e 100644 --- a/source/create_dialog_derived.cpp +++ b/source/create_dialog_derived.cpp @@ -71,8 +71,8 @@ void CreateProjectDialogD::OnCreate(wxCommandEvent& event){ //assemble the command that will create the project described by the dialog editor& e = editors[GetSelectedEditorIndex()]; - auto executablePath = e.path / e.name / executable; - auto executableTemplatesPath = e.path / e.name / templatesDir; + auto executablePath = e.executablePath(); + auto executableTemplatesPath = e.templatePath(); string projName = projNameTxt->GetValue().ToStdString(); string projPath = projLocTxt->GetValue().ToStdString(); diff --git a/source/globals.h b/source/globals.h index 3e1d985e..b525e558 100644 --- a/source/globals.h +++ b/source/globals.h @@ -29,11 +29,11 @@ struct wxWindow; static constexpr std::string_view installerExt = "dmg"; //where to find various Unity things on macOS - static const std::filesystem::path executable = "Unity.app/Contents/MacOS/Unity"; + static const std::filesystem::path executable = "Contents/MacOS/Unity"; static const std::vector defaultInstall = {"/Applications/Unity/Hub/Editor","/Applications/Unity/"}; //TODO: make this a preference? static const std::filesystem::path hubDefault = "/Applications/Unity Hub.app"; - static const std::filesystem::path templatesDir = "Unity.app/Contents/Resources/PackageManager/ProjectTemplates/"; + static const std::filesystem::path templatesDir = "Contents/Resources/PackageManager/ProjectTemplates/"; //for stream redirecting to dev/null static constexpr std::string_view null_device = ">/dev/null 2>&1"; @@ -123,6 +123,10 @@ struct editor { return path / name / executable; #endif } + + auto templatePath() const{ + return path / templatesDir; + } bool operator==(const editor& other) { return this->name == other.name; // many editors can share a root path diff --git a/source/interface_derived.cpp b/source/interface_derived.cpp index 1ff04cc3..012406fb 100644 --- a/source/interface_derived.cpp +++ b/source/interface_derived.cpp @@ -618,13 +618,19 @@ void MainFrameDerived::LoadEditorVersions(){ // unity versions at once, which sucks. To get the version, // we need to parse the info.plist inside of Unity.app auto infopath = entry / "Unity.app" / "Contents" / "Info.plist"; - if (filesystem::exists(infopath)){ + auto basedir = entry / "Unity.app"; + if (!filesystem::exists(infopath)){ + // maybe this was a direct install + infopath = entry / "Contents" / "Info.plist"; + basedir = entry; + } + if (filesystem::exists(infopath) && infopath.string().find("Unity.app") != std::string::npos){ // read the file and look for CFBundleVersion char buffer[16]{0}; getCFBundleVersionFromPlist(infopath.string().c_str(), buffer, sizeof(buffer)); //add it to the backing datastructure - editor e = {buffer, entry}; + editor e = {buffer, basedir}; addInstall(e); } #else