mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 21:54:32 +00:00
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
Peter Steinberger
parent
ff0ce32840
commit
1c36bec970
@@ -68,7 +68,15 @@ export function resolveRuntimePlatform(): string {
|
|||||||
export function hasBinary(bin: string): boolean {
|
export function hasBinary(bin: string): boolean {
|
||||||
const pathEnv = process.env.PATH ?? "";
|
const pathEnv = process.env.PATH ?? "";
|
||||||
const parts = pathEnv.split(path.delimiter).filter(Boolean);
|
const parts = pathEnv.split(path.delimiter).filter(Boolean);
|
||||||
const extensions = process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""];
|
const extensions =
|
||||||
|
process.platform === "win32"
|
||||||
|
? [
|
||||||
|
"",
|
||||||
|
...(process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM")
|
||||||
|
.split(";")
|
||||||
|
.filter(Boolean),
|
||||||
|
]
|
||||||
|
: [""];
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
for (const ext of extensions) {
|
for (const ext of extensions) {
|
||||||
const candidate = path.join(part, bin + ext);
|
const candidate = path.join(part, bin + ext);
|
||||||
|
|||||||
Reference in New Issue
Block a user