UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

37 lines (36 loc) • 1.19 kB
import { i as executableFileExistsSync } from "./path-existence-Co7-GyVr.mjs"; import "./path-existence-runtime-LOpU--Vt.mjs"; import path from "node:path"; //#region extensions/crabbox/src/crabbox-binary.ts function binaryCandidates(e, t) { return t === "win32" ? [ ".exe", ".cmd", ".bat", ".com", "" ].map((t) => `${e}${t}`) : [e]; } function resolveCrabboxBinary(e) { return e.explicit || findCrabboxBinary(e) || "crabbox"; } function findCrabboxBinary(e) { const t = e.platform ?? process.platform; const n = e.isExecutable ?? ((e) => executableFileExistsSync(e, t)); if (e.explicit) return n(e.cwd ? path.resolve(e.cwd, e.explicit) : e.explicit) ? e.explicit : void 0; if (e.openclawRoot) { const r = path.resolve(e.cwd ?? ".", e.openclawRoot, "../crabbox/bin/crabbox"); for (const e of binaryCandidates(r, t)) if (n(e)) return e; } const r = t === "win32" ? ";" : ":"; const i = binaryCandidates("crabbox", t); for (const t of (e.pathEnv ?? "").split(r)) { if (!t) continue; for (const r of i) { const i = path.resolve(e.cwd ?? ".", t, r); if (n(i)) return i; } } } //#endregion export { resolveCrabboxBinary as n, findCrabboxBinary as t };