Skip to content

Commit 9e0f4c8

Browse files
hetpatel-11claude
andcommitted
fix: resolve transcription script path inside packaged app.asar
In packaged builds, dirname(import.meta.url) + 4 levels up lands outside the asar, so LOCAL_TRANSCRIBE_SCRIPT didn't exist and isLocalAvailable() returned false. Use app.getAppPath() (with package.json walk fallback) so the path resolves both in dev and in the built app. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent edc7735 commit 9e0f4c8

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/main/services/transcription-service.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@ import { resolveFfmpegBinary } from './media-binaries.js'
1111

1212
const SERVICE_DIR = dirname(fileURLToPath(import.meta.url))
1313
const CWD_ROOT = process.cwd()
14-
const FILE_ROOT = join(SERVICE_DIR, '..', '..', '..', '..')
15-
const APP_ROOT = existsSync(join(CWD_ROOT, 'package.json')) ? CWD_ROOT : FILE_ROOT
14+
function resolveAppRoot(): string {
15+
if (existsSync(join(CWD_ROOT, 'package.json'))) return CWD_ROOT
16+
try {
17+
const electronAppPath = app.getAppPath()
18+
if (electronAppPath) return electronAppPath
19+
} catch {
20+
// app not ready yet
21+
}
22+
for (let depth = 1; depth <= 5; depth++) {
23+
const candidate = join(SERVICE_DIR, ...Array(depth).fill('..'))
24+
if (existsSync(join(candidate, 'package.json'))) return candidate
25+
}
26+
return join(SERVICE_DIR, '..', '..', '..')
27+
}
28+
const APP_ROOT = resolveAppRoot()
1629
const LOCAL_VENV_PYTHON_DEV = join(APP_ROOT, '.python-runtime', 'bin', 'python')
1730
function getUserDataVenvPython(): string {
1831
try {

0 commit comments

Comments
 (0)