()
| 10 | let cachedNodeExecutable: string | null = null |
| 11 | |
| 12 | export function getRuntimeHostPath() { |
| 13 | const siblingWorkerPath = fileURLToPath(new URL('./worker.mjs', import.meta.url)) |
| 14 | const siblingUnpackedWorkerPath = getAsarUnpackedPath(siblingWorkerPath) |
| 15 | if (siblingUnpackedWorkerPath && existsSync(siblingUnpackedWorkerPath)) { |
| 16 | return siblingUnpackedWorkerPath |
| 17 | } |
| 18 | if (existsSync(siblingWorkerPath)) return siblingWorkerPath |
| 19 | |
| 20 | const bundledBridgeWorkerPath = fileURLToPath(new URL('./desktop/worker.mjs', import.meta.url)) |
| 21 | const bundledBridgeUnpackedWorkerPath = getAsarUnpackedPath(bundledBridgeWorkerPath) |
| 22 | if (bundledBridgeUnpackedWorkerPath && existsSync(bundledBridgeUnpackedWorkerPath)) { |
| 23 | return bundledBridgeUnpackedWorkerPath |
| 24 | } |
| 25 | if (existsSync(bundledBridgeWorkerPath)) return bundledBridgeWorkerPath |
| 26 | |
| 27 | return path.join(process.cwd(), 'build', 'desktop', 'worker.mjs') |
| 28 | } |
| 29 | |
| 30 | function getAsarUnpackedPath(filePath: string) { |
| 31 | return filePath.includes('.asar') ? filePath.replace('.asar', '.asar.unpacked') : null |
no test coverage detected