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_spaces_within_object_literal_braces = true
ij_javascript_indent_chained_calls = true
ij_javascript_if_brace_force = if_multiline
[{*.json,*.json5}]
ij_json_keep_trailing_comma = false

View File

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