fix: 🐛 Fix for built-in scrcpy not supporting x64 macos

This commit is contained in:
viarotel 2024-11-26 18:13:31 +08:00
parent cb2efef3f9
commit 0d606550d4

View File

@ -2,16 +2,19 @@ import { extraResolve } from '$electron/helpers/index.js'
import which from 'which' import which from 'which'
export const getScrcpyPath = () => { export const getScrcpyPath = () => {
switch (process.platform) { if (['win32'].includes(process.platform)) {
case 'win32': return extraResolve('win/scrcpy/scrcpy.exe')
return extraResolve('win/scrcpy/scrcpy.exe')
case 'darwin':
return extraResolve(`mac/scrcpy/scrcpy`)
case 'linux':
return extraResolve('linux/scrcpy/scrcpy')
default:
return which.sync('scrcpy', { nothrow: true })
} }
else if (['darwin'].includes(process.platform)) {
if (['arm64'].includes(process.arch)) {
return extraResolve(`mac/scrcpy/scrcpy`)
}
}
else if (['linux'].includes(process.platform)) {
return extraResolve('linux/scrcpy/scrcpy')
}
return which.sync('scrcpy', { nothrow: true })
} }
export const scrcpyPath = getScrcpyPath() export const scrcpyPath = getScrcpyPath()