Merge branch 'main' into local-pr-3734

This commit is contained in:
suyao
2025-03-28 16:30:17 +08:00
64 changed files with 1174 additions and 1484 deletions
+4
View File
@@ -42,3 +42,7 @@ export function dumpPersistState() {
}
return JSON.stringify(persistState)
}
export const runAsyncFunction = async (fn: () => void) => {
await fn()
}
+9 -3
View File
@@ -35,12 +35,18 @@ export function runInstallScript(scriptPath: string): Promise<void> {
})
}
export async function getBinaryName(name: string): Promise<string> {
if (process.platform === 'win32') {
return `${name}.exe`
}
return name
}
export async function getBinaryPath(name: string): Promise<string> {
let cmd = process.platform === 'win32' ? `${name}.exe` : name
const binaryName = await getBinaryName(name)
const binariesDir = path.join(os.homedir(), '.cherrystudio', 'bin')
const binariesDirExists = await fs.existsSync(binariesDir)
cmd = binariesDirExists ? path.join(binariesDir, cmd) : name
return cmd
return binariesDirExists ? path.join(binariesDir, binaryName) : binaryName
}
export async function isBinaryExists(name: string): Promise<boolean> {