fix: resolve the built thothctl binary per platform

This commit is contained in:
2026-08-11 19:06:04 +02:00
parent 16eb3d120d
commit 4d23ad4e85
+5 -2
View File
@@ -815,9 +815,12 @@ async function writeInstallationFiles(ctx) {
} }
function thothctlBinaryPath(repositoryRoot) { function thothctlBinaryPath(repositoryRoot) {
const platform = { darwin: "darwin", linux: "linux", win32: "windows" }[process.platform] ?? "linux";
const arch = { x64: "amd64", arm64: "arm64" }[process.arch] ?? "amd64";
const suffix = platform === "windows" ? ".exe" : "";
const candidates = [ const candidates = [
join(repositoryRoot, "tools", "thothctl", "bin", "thothctl"), join(repositoryRoot, "dist", "thothctl", `thothctl-${platform}-${arch}${suffix}`),
join(repositoryRoot, "dist", "thothctl", "bin", "thothctl"), join(repositoryRoot, "tools", "thothctl", "bin", `thothctl${suffix}`),
]; ];
for (const candidate of candidates) if (existsSync(candidate)) return candidate; for (const candidate of candidates) if (existsSync(candidate)) return candidate;
throw new Error("built thothctl binary is unavailable"); throw new Error("built thothctl binary is unavailable");