Fix #26306: Check Homebrew paths when FindApp fails on macOS (#26307)

Fixes #26306, this allowed the set-up process to continue on my system.
This commit is contained in:
Sjoerd de Bruin
2026-04-03 23:22:36 +02:00
committed by GitHub
parent 6f8533462a
commit 1653e167bb
3 changed files with 24 additions and 5 deletions
+1
View File
@@ -259,6 +259,7 @@ Appreciation for contributors who have provided substantial work, but are no lon
* Marcel Vos (MarcelVos96)
* Jonas Doggart
* (pg805)
* Sjoerd de Bruin (sjoerddebruin)
## Toolchain
* (Balletie) - macOS
+1
View File
@@ -25,6 +25,7 @@
- Fix: [#26196] The sprites of one angle of the Steeplechase left large turn are misaligned (original bug).
- Fix: [#26214] The wrong sprite is used for one angle of the gentle diagonal slope of Alpine, Hybrid and Single Rail tracks.
- Fix: [#26243] Increase max dropdown size from 512 to 1024 to accommodate parks with more than 512 rides.
- Fix: [#26306] Platform::FindApp fails to locate Homebrew-installed tools on macOS.
0.4.32 (2026-03-01)
------------------------------------------------------------------------
+23 -6
View File
@@ -115,14 +115,31 @@ namespace OpenRCT2::Platform
bool FindApp(std::string_view app, std::string* output)
{
std::string appStr = std::string(app);
const char* args[] = { appStr.c_str(), "--version", nullptr };
int result = Execute(args, nullptr);
if (result == 0 && output)
auto tryPath = [&](const std::string& path) -> bool {
const char* args[] = { path.c_str(), "--version", nullptr };
if (Execute(args, nullptr) == 0)
{
*output = appStr;
if (output)
*output = path;
return true;
}
return result == 0;
return false;
};
std::string appStr = std::string(app);
if (tryPath(appStr))
return true;
#ifdef __APPLE__
// Apps on macOS don't inherit the shell PATH, so check common Homebrew install locations as a fallback.
for (const char* prefix : { "/opt/homebrew/bin/", "/usr/local/bin/" })
{
if (tryPath(std::string(prefix) + appStr))
return true;
}
#endif
return false;
}
int32_t Execute(const char* args[], std::string* output)