in src/browser.js [198:229]
function browserInstalled (browser) {
// On Windows, the 'start' command searches the path then 'App Paths' in the registry.
// We do the same here. Note that the start command uses the PATHEXT environment variable
// for the list of extensions to use if no extension is provided. We simplify that to just '.EXE'
// since that is what all the supported browsers use. Check path (simple but usually won't get a hit)
const promise = new Promise((resolve, reject) => {
if (which.sync(browser, { nothrow: true })) {
return resolve();
} else {
const regQPre = 'reg QUERY "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\';
const regQPost = '.EXE" /v ""';
const regQuery = regQPre + browser.split(' ')[0] + regQPost;
child_process.exec(regQuery, (err, stdout, stderr) => {
if (err) {
// The registry key does not exist, which just means the app is not installed.
reject(err);
} else {
const result = regItemPattern.exec(stdout);
if (fs.existsSync(trimRegPath(result[2]))) {
resolve();
} else {
// The default value is not a file that exists, which means the app is not installed.
reject(new Error(NOT_INSTALLED));
}
}
});
}
});
return promise;
}