MCPcopy Create free account
hub / github.com/backnotprop/plannotator / getWindowsPathCandidates

Function getWindowsPathCandidates

apps/opencode-plugin/cli-bridge.ts:102–119  ·  view source on GitHub ↗
(bin: string, env: NodeJS.ProcessEnv)

Source from the content-addressed store, hash-verified

100}
101
102function getWindowsPathCandidates(bin: string, env: NodeJS.ProcessEnv): string[] {
103 if (path.extname(bin)) return [bin];
104
105 const extensions = (env.PATHEXT || ".COM;.EXE;.BAT;.CMD")
106 .split(";")
107 .map((ext) => ext.trim().toLowerCase())
108 .filter(Boolean);
109 // The Windows installer ships plannotator.exe. Avoid auto-resolving .cmd/.bat
110 // shims because those require cmd.exe and would reintroduce shell tokenization.
111 const executableExtensions = extensions.filter((ext) => ext !== ".cmd" && ext !== ".bat");
112 const preferred = [".exe", ".com"];
113 const orderedExtensions = [
114 ...preferred.filter((ext) => executableExtensions.includes(ext)),
115 ...executableExtensions.filter((ext) => !preferred.includes(ext)),
116 ];
117
118 return [...orderedExtensions.map((ext) => `${bin}${ext}`), bin];
119}
120
121export function resolveWindowsCliCommand(bin: string, env: NodeJS.ProcessEnv = process.env): string | undefined {
122 const pathValue = env.PATH || "";

Callers 1

resolveWindowsCliCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected