Skip to content

Commit

Permalink
feat: support cursor and other VSCode forks
Browse files Browse the repository at this point in the history
  • Loading branch information
subframe7536 committed Dec 19, 2024
1 parent 6bb593e commit cdde3f3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,19 @@ function getAppBinary(...binDirectories: string[]): string {
// remove tunnel
let files = fs.readdirSync(dir).filter(file => !file.includes('-tunnel'))

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

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

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

throw new Error('Can determine binary path')
throw new Error(`Cannot find binary path in [${binDirectories}]`)
}

async function restartMacOS() {
Expand Down Expand Up @@ -78,7 +76,7 @@ async function restartMacOS() {
async function restartWindows() {
const appHomeDir = path.dirname(process.execPath)
const exeName = path.basename(process.execPath, '.exe')
const binary = getAppBinary(`${appHomeDir}/bin/`, `${path.dirname(baseDir)}/bin/`)
const binary = getAppBinary(`${appHomeDir}\\bin\\`, `${path.dirname(baseDir)}\\bin\\`)

const checkScript = [
'for ($i = 0; $i -lt 100; $i++) {',
Expand Down

0 comments on commit cdde3f3

Please sign in to comment.