|
1 | 1 | import { tmpdir } from "os"
|
2 |
| -import { dirname } from "path" |
| 2 | +import { dirname, join } from "path" |
3 | 3 | import { type AddPathOptions, addPath } from "envosman"
|
4 | 4 | import { execaSync } from "execa"
|
5 | 5 | import { DownloaderHelper } from "node-downloader-helper"
|
@@ -64,23 +64,33 @@ export async function setupBrew(options: SetupBrewOptions = {}): Promise<Install
|
64 | 64 | return { binDir }
|
65 | 65 | }
|
66 | 66 |
|
| 67 | +/** |
| 68 | + * Get the path to the bin directory of brew |
| 69 | + * @returns {string} The path where brew binary is installed |
| 70 | + * |
| 71 | + * Based on the installation script from https://brew.sh |
| 72 | + */ |
| 73 | +export function getBrewBinDir() { |
| 74 | + return join(getBrewDir(), "bin") |
| 75 | +} |
| 76 | + |
67 | 77 | /**
|
68 | 78 | * Get the path where brew is installed
|
69 | 79 | * @returns {string} The path where brew is installed
|
70 | 80 | *
|
71 | 81 | * Based on the installation script from https://brew.sh
|
72 | 82 | */
|
73 |
| -export function getBrewBinDir() { |
| 83 | +export function getBrewDir() { |
74 | 84 | if (process.platform === "darwin") {
|
75 | 85 | if (process.arch === "arm64") {
|
76 |
| - return "/opt/homebrew/bin/" |
| 86 | + return "/opt/homebrew" |
77 | 87 | } else {
|
78 |
| - return "/usr/local/bin/" |
| 88 | + return "/usr/local" |
79 | 89 | }
|
80 | 90 | }
|
81 | 91 |
|
82 | 92 | if (process.platform === "linux") {
|
83 |
| - return "/home/linuxbrew/.linuxbrew/bin/" |
| 93 | + return "/home/linuxbrew/.linuxbrew" |
84 | 94 | }
|
85 | 95 |
|
86 | 96 | throw new Error("Unsupported platform for brew")
|
|
0 commit comments