UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 971 B
import{c as resolveUserPath}from"./home-dir-DEN5DisQ.mjs";import"./utils-Dlk0IYAa.mjs";import{i as resolveEnvironmentValue}from"./process-env-BMQKxoSL.mjs";import{r as isExecutableFileAsync,s as resolveExecutableFromPathEnvAsync}from"./executable-path-BYWCW0PG.mjs";import{t as isSafeExecutableValue}from"./exec-safety-BbcNVowA.mjs";import path from"node:path"; //!src/infra/detect-binary.ts async function detectBinary(e){if(!isSafeExecutableValue(e))return false;const t=e.startsWith(`~`)?resolveUserPath(e):e;if(path.isAbsolute(t)||t.startsWith(`.`)||t.includes(`/`)||t.includes(`\\`))return isExecutableFileAsync(t);try{const t=process.cwd();const n=resolveEnvironmentValue(process.env,`PATH`)??``;const r=process.platform===`win32`?`${t};${n}`:n;const i=process.platform===`win32`?path.extname(e):``;const a=i?{PATHEXT:i}:process.env;return Boolean(await resolveExecutableFromPathEnvAsync(e,r,a,{cwd:t,useCache:false}))}catch{return false}}export{detectBinary as t};