MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / findWindowsShim

Function findWindowsShim

scripts/add-lang/verify-extraction.mjs:29–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27// under one of PATHEXT's runnable extensions. Only a .cmd or .bat needs the
28// shell; an .exe or .com is found by the plain call below on its own.
29function findWindowsShim() {
30 const runnable = ['.com', '.exe', '.bat', '.cmd'];
31 const exts = (process.env.PATHEXT || runnable.join(';')).toLowerCase().split(';').filter((e) => runnable.includes(e));
32 for (const dir of (process.env.PATH || '').split(path.delimiter)) {
33 if (!dir) continue;
34 for (const ext of exts) {
35 const file = path.join(dir, `codegraph${ext}`);
36 if (existsSync(file)) return ext === '.bat' || ext === '.cmd' ? file : null;
37 }
38 }
39 return null;
40}
41
42// One token of a command line for cmd.exe, which hands it on to node.exe
43// through the shim's %*. Double quotes keep it one argument for the C runtime

Callers 1

runCodegraphFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected