From 0d606550d437aaf81094a0783ff4986a8135d74a Mon Sep 17 00:00:00 2001 From: viarotel Date: Tue, 26 Nov 2024 18:13:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20for=20built-in=20sc?= =?UTF-8?q?rcpy=20not=20supporting=20x64=20macos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/configs/scrcpy/index.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/electron/configs/scrcpy/index.js b/electron/configs/scrcpy/index.js index 0906a4e1..e6293e9c 100644 --- a/electron/configs/scrcpy/index.js +++ b/electron/configs/scrcpy/index.js @@ -2,16 +2,19 @@ import { extraResolve } from '$electron/helpers/index.js' import which from 'which' export const getScrcpyPath = () => { - switch (process.platform) { - case 'win32': - return extraResolve('win/scrcpy/scrcpy.exe') - case 'darwin': + if (['win32'].includes(process.platform)) { + return extraResolve('win/scrcpy/scrcpy.exe') + } + else if (['darwin'].includes(process.platform)) { + if (['arm64'].includes(process.arch)) { return extraResolve(`mac/scrcpy/scrcpy`) - case 'linux': - return extraResolve('linux/scrcpy/scrcpy') - default: - return which.sync('scrcpy', { nothrow: true }) + } + } + else if (['linux'].includes(process.platform)) { + return extraResolve('linux/scrcpy/scrcpy') } + + return which.sync('scrcpy', { nothrow: true }) } export const scrcpyPath = getScrcpyPath()