forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresolveHelperPath.ts
More file actions
22 lines (21 loc) · 824 Bytes
/
Copy pathresolveHelperPath.ts
File metadata and controls
22 lines (21 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { app } from 'electron'
import { join } from 'path'
import { existsSync } from 'fs'
/**
* Resolve the on-disk path to the bundled win-audio-helper.exe.
* Mirrors src/main/automation/resolveHelperPath.ts (packaged-unpacked,
* extraResources, dev). Returns the dev path last so the bridge surfaces a clear
* "not found" when the helper was never built (no .NET SDK).
*/
export function resolveAudioHelperPath(): string {
const exe = 'win-audio-helper.exe'
const candidates = [
join(process.resourcesPath, 'app.asar.unpacked', 'resources', 'win-audio-helper', exe),
join(process.resourcesPath, 'win-audio-helper', exe),
join(app.getAppPath(), 'resources', 'win-audio-helper', exe)
]
for (const c of candidates) {
if (existsSync(c)) return c
}
return candidates[candidates.length - 1]
}