Skip to content

Commit

Permalink
feat: multiple bin path detect
Browse files Browse the repository at this point in the history
  • Loading branch information
subframe7536 committed Dec 18, 2024
1 parent a5da38a commit 37f5623
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,25 @@ export async function restartApp(): Promise<void> {
sp.unref()
}

function getAppBinary(appHomeDir: string): string {
// remove tunnel
let files = fs.readdirSync(appHomeDir).filter(file => !file.includes('-tunnel'))
function getAppBinary(...binDirectories: string[]): string {
for (const dir of binDirectories) {
if (!fs.existsSync(dir)) {
continue
}
// remove tunnel
let files = fs.readdirSync(dir).filter(file => !file.includes('-tunnel'))

if (files.length === 1) {
return path.join(appHomeDir, files[0])
}
if (files.length === 1) {
return path.join(dir, files[0])
}

if (process.platform === 'win32') {
// select *.cmd
files = files.filter(file => file.endsWith('.cmd'))
if (process.platform === 'win32') {
// select *.cmd
files = files.filter(file => file.endsWith('.cmd'))

if (files.length === 1) {
return path.join(appHomeDir, files[0])
if (files.length === 1) {
return path.join(dir, files[0])
}
}
}

Expand Down

0 comments on commit 37f5623

Please sign in to comment.