This commit is contained in:
Ayakura Yuki 2023-09-06 15:33:46 +08:00
parent 6d7587580f
commit 31e99f2750
2 changed files with 23 additions and 36 deletions

View File

@ -21,6 +21,7 @@ ij_javascript_enforce_trailing_comma = keep
ij_javascript_space_before_method_parentheses = true ij_javascript_space_before_method_parentheses = true
ij_javascript_spaces_within_object_literal_braces = true ij_javascript_spaces_within_object_literal_braces = true
ij_javascript_indent_chained_calls = true ij_javascript_indent_chained_calls = true
ij_javascript_if_brace_force = if_multiline
[{*.json,*.json5}] [{*.json,*.json5}]
ij_json_keep_trailing_comma = false ij_json_keep_trailing_comma = false

View File

@ -6,51 +6,37 @@ const arch = os.arch()
let skipDownload = false let skipDownload = false
let executablePath let executablePath
// linux / android if (process.platform === 'linux' || process.platform === 'android')
if (process.platform === 'linux' || process.platform === 'android') {
for (const item of [ for (const item of [
"chromium", "chromium",
"chromium-browser", "chromium-browser",
"chrome", "chrome",
]) { ]) try {
try { const chromiumPath = execSync(`command -v ${item}`).toString().trim()
const chromiumPath = execSync(`command -v ${item}`).toString().trim() if (chromiumPath && existsSync(chromiumPath)) {
if (chromiumPath && existsSync(chromiumPath)) { executablePath = chromiumPath
executablePath = chromiumPath break
break
}
} catch (err) {
} }
} } catch (err) {}
}
// macOS // macOS
if (process.platform === 'darwin') { if (process.platform === 'darwin') for (const item of [
for (const item of [ '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge', ]) if (existsSync(item)) {
]) { executablePath = item
if (existsSync(item)) { break
executablePath = item
break
}
}
} }
// windows 或其他 if (!executablePath) for (const item of [
if (!executablePath) { '/usr/bin/chromium',
for (const item of [ '/usr/bin/chromium-browser',
'/usr/bin/chromium', '/usr/bin/chrome',
'/usr/bin/chromium-browser', 'C:/Program Files/Google/Chrome/Application/chrome.exe',
'/usr/bin/chrome', 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
'C:/Program Files/Google/Chrome/Application/chrome.exe', ]) if (existsSync(item)) {
'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe', executablePath = item
]) { break
if (existsSync(item)) {
executablePath = item
break
}
}
} }
if (executablePath || arch === 'arm64' || arch === 'aarch64') { if (executablePath || arch === 'arm64' || arch === 'aarch64') {