This commit is contained in:
2023-03-07 10:52:05 +07:00
commit 772f105c65
1032 changed files with 260918 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
const path = require('path').win32;
const { canAccess } = require('./util');
const procesEnv = process.env;
function win32(includeChromium = false) {
const installations = [];
const suffixes = [
'\\Google\\Chrome SxS\\Application\\chrome.exe',
'\\Google\\Chrome\\Application\\chrome.exe',
'\\chrome-win32\\chrome.exe',
... includeChromium ? ['\\Chromium\\Application\\chrome.exe'] : [],
// '\\Google\\Chrome Beta\\Application\\chrome.exe',
];
const prefixes = [
procesEnv.LOCALAPPDATA,
procesEnv.PROGRAMFILES,
procesEnv['PROGRAMFILES(X86)']
].filter(prefix => prefix); // filter out undefined
prefixes.forEach(prefix => suffixes.forEach(suffix => {
const chromePath = path.join(prefix, suffix);
if (canAccess(chromePath)) {
installations.push(chromePath);
}
}));
return installations;
}
module.exports = win32;