Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const topDir = path.dirname(testPath);
for (const subVersion of await fs.readdir(topDir)) {
if (!(await fs.stat(path.resolve(topDir, subVersion))).isDirectory()) continue; // eslint-disable-line max-len, no-continue
if (subVersion.substr(0, 2) !== '10') continue; // eslint-disable-line no-continue
testExe = path.resolve(topDir, subVersion, 'x64', 'makecert.exe');
if (await fs.pathExists(testExe)) {
sdkTool = testExe;
break;
}
}
}
}
if (!sdkTool || !await fs.pathExists(sdkTool)) {
sdkTool = resolveCommand({ command: exe, options: { cwd: null } }, true);
}
if (!sdkTool || !await fs.pathExists(sdkTool)) {
throw new Error(`Can't find ${exe} in PATH. You probably need to install the Windows SDK.`);
}
return sdkTool;
}