mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2024-11-14 18:57:40 +01:00
fix: 🔧 修复 Linux 及 MacOS 获取默认依赖路径异常的问题
This commit is contained in:
parent
45af64e07f
commit
87b533f714
@ -1,4 +1,5 @@
|
||||
import { resolve } from 'node:path'
|
||||
import which from 'which'
|
||||
|
||||
import { buildResolve, extraResolve } from '@electron/helpers/index.js'
|
||||
|
||||
@ -11,7 +12,14 @@ export const icoLogoPath = buildResolve('logo.ico')
|
||||
export const icnsLogoPath = buildResolve('logo.icns')
|
||||
|
||||
export const adbPath
|
||||
= process.platform === 'win32' ? extraResolve('core/adb.exe') : 'adb'
|
||||
= process.platform === 'win32'
|
||||
? extraResolve('core/adb.exe')
|
||||
: which.sync('adb', { nothrow: true })
|
||||
|
||||
export const scrcpyPath
|
||||
= process.platform === 'win32' ? extraResolve('core/scrcpy.exe') : 'scrcpy'
|
||||
= process.platform === 'win32'
|
||||
? extraResolve('core/scrcpy.exe')
|
||||
: which.sync('scrcpy', { nothrow: true })
|
||||
|
||||
// console.log('adbPath', adbPath)
|
||||
// console.log('scrcpyPath', scrcpyPath)
|
||||
|
@ -4,7 +4,6 @@ import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import dayjs from 'dayjs'
|
||||
import { Adb } from '@devicefarmer/adbkit'
|
||||
import _which from 'which'
|
||||
import appStore from '@electron/helpers/store.js'
|
||||
import { adbPath } from '@electron/configs/index.js'
|
||||
|
||||
@ -100,8 +99,6 @@ const install = async (id, path) => client.getDevice(id).install(path)
|
||||
|
||||
const version = async () => client.version()
|
||||
|
||||
const which = async () => _which('adb')
|
||||
|
||||
const watch = async (callback) => {
|
||||
const tracker = await client.trackDevices()
|
||||
tracker.on('add', async (ret) => {
|
||||
@ -147,7 +144,6 @@ export default () => {
|
||||
screencap,
|
||||
install,
|
||||
version,
|
||||
which,
|
||||
watch,
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { spawn } from 'node:child_process'
|
||||
import _which from 'which'
|
||||
import appStore from '@electron/helpers/store.js'
|
||||
import { adbPath, scrcpyPath } from '@electron/configs/index.js'
|
||||
|
||||
@ -48,9 +47,6 @@ const shell = async (command, { stdout, stderr } = {}) => {
|
||||
})
|
||||
}
|
||||
|
||||
const which = async () => _which('scrcpy')
|
||||
|
||||
export default () => ({
|
||||
shell,
|
||||
which,
|
||||
})
|
||||
|
13
src/App.vue
13
src/App.vue
@ -55,15 +55,14 @@ export default {
|
||||
return false
|
||||
}
|
||||
|
||||
try {
|
||||
const adbWhichPath = await this.$adb.which()
|
||||
console.log('adbWhichPath', adbWhichPath)
|
||||
const scrcpyWhichPath = await this.$scrcpy.which()
|
||||
console.log('scrcpyWhichPath', scrcpyWhichPath)
|
||||
const { adbPath, scrcpyPath } = this.$electron?.configs || {}
|
||||
|
||||
if (adbPath) {
|
||||
return false
|
||||
}
|
||||
catch (error) {
|
||||
console.warn(error?.message || error?.cause?.message)
|
||||
|
||||
if (scrcpyPath) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.$alert(
|
||||
|
Loading…
Reference in New Issue
Block a user