From 9777622830e2160ce84511052a79951638ff0771 Mon Sep 17 00:00:00 2001 From: viarotel Date: Thu, 5 Dec 2024 09:49:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E2=99=BB=EF=B8=8F=20Fixed=20repeated=20?= =?UTF-8?q?dependency=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/configs/scrcpy/index.js | 9 ++++----- electron/helpers/index.js | 7 ------- .../extra/{mac => mac-x64}/scrcpy/icon.png | Bin .../resources/extra/{mac => mac-x64}/scrcpy/scrcpy | Bin .../extra/{mac => mac-x64}/scrcpy/scrcpy-server | Bin .../extra/{mac => mac-x64}/scrcpy/scrcpy.1 | 0 6 files changed, 4 insertions(+), 12 deletions(-) rename electron/resources/extra/{mac => mac-x64}/scrcpy/icon.png (100%) rename electron/resources/extra/{mac => mac-x64}/scrcpy/scrcpy (100%) rename electron/resources/extra/{mac => mac-x64}/scrcpy/scrcpy-server (100%) rename electron/resources/extra/{mac => mac-x64}/scrcpy/scrcpy.1 (100%) diff --git a/electron/configs/scrcpy/index.js b/electron/configs/scrcpy/index.js index 5aaca125..94e2916d 100644 --- a/electron/configs/scrcpy/index.js +++ b/electron/configs/scrcpy/index.js @@ -1,15 +1,14 @@ -import { archResolve, extraResolve } from '$electron/helpers/index.js' +import { extraResolve } from '$electron/helpers/index.js' import which from 'which' export function getScrcpyPath() { switch (process.platform) { case 'win32': - return extraResolve(archResolve('win#{arch}/scrcpy/scrcpy.exe')) + return extraResolve('win/scrcpy/scrcpy.exe') case 'darwin': - return extraResolve(archResolve('mac#{arch}/scrcpy/scrcpy')) + return extraResolve(`mac-${process.arch}/scrcpy/scrcpy`) case 'linux': - return extraResolve(archResolve('linux#{arch}/scrcpy/scrcpy')) - + return extraResolve('linux/scrcpy/scrcpy') default: return which.sync('scrcpy', { nothrow: true }) } diff --git a/electron/helpers/index.js b/electron/helpers/index.js index c50b9eef..30393a90 100644 --- a/electron/helpers/index.js +++ b/electron/helpers/index.js @@ -68,10 +68,3 @@ export function loadPage(win, prefix = '') { win.loadFile(join(process.env.DIST, prefix, 'index.html')) } } - -export function archResolve(filePath = '', { template = '#{arch}', defaultArch = 'x64' } = {}) { - const arch = ![defaultArch].includes(process.arch) ? `-${process.arch}` : '' - - const value = filePath.replaceAll(template, arch) - return value -} diff --git a/electron/resources/extra/mac/scrcpy/icon.png b/electron/resources/extra/mac-x64/scrcpy/icon.png similarity index 100% rename from electron/resources/extra/mac/scrcpy/icon.png rename to electron/resources/extra/mac-x64/scrcpy/icon.png diff --git a/electron/resources/extra/mac/scrcpy/scrcpy b/electron/resources/extra/mac-x64/scrcpy/scrcpy similarity index 100% rename from electron/resources/extra/mac/scrcpy/scrcpy rename to electron/resources/extra/mac-x64/scrcpy/scrcpy diff --git a/electron/resources/extra/mac/scrcpy/scrcpy-server b/electron/resources/extra/mac-x64/scrcpy/scrcpy-server similarity index 100% rename from electron/resources/extra/mac/scrcpy/scrcpy-server rename to electron/resources/extra/mac-x64/scrcpy/scrcpy-server diff --git a/electron/resources/extra/mac/scrcpy/scrcpy.1 b/electron/resources/extra/mac-x64/scrcpy/scrcpy.1 similarity index 100% rename from electron/resources/extra/mac/scrcpy/scrcpy.1 rename to electron/resources/extra/mac-x64/scrcpy/scrcpy.1