Fix Windows packaged Orca CLI launcher path resolution (#282)

This commit is contained in:
Jinwoo Hong 2026-04-04 01:20:09 -04:00 committed by GitHub
parent 1c6d5a1fa0
commit 46070d8f27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View file

@ -2,7 +2,11 @@
setlocal
set "SCRIPT_DIR=%~dp0"
for %%I in ("%SCRIPT_DIR%..") do set "RESOURCES_DIR=%%~fI"
for %%I in ("%RESOURCES_DIR%..") do set "APP_DIR=%%~fI"
REM Why: once %%~fI canonicalizes RESOURCES_DIR it no longer ends with a slash,
REM so Windows batch needs an explicit "\.." segment here. Without it the CLI
REM launcher resolves APP_DIR back to resources/ and `orca open` cannot find
REM Orca.exe on packaged Windows installs.
for %%I in ("%RESOURCES_DIR%\..") do set "APP_DIR=%%~fI"
set "ELECTRON=%APP_DIR%\Orca.exe"
if not exist "%ELECTRON%" (

View file

@ -0,0 +1,13 @@
import { readFileSync } from 'fs'
import { join } from 'path'
import { describe, expect, it } from 'vitest'
describe('packaged Windows CLI launcher asset', () => {
it('walks from resources/bin back to the app root before locating Orca.exe', () => {
const launcherPath = join(process.cwd(), 'resources', 'win32', 'bin', 'orca.cmd')
const launcher = readFileSync(launcherPath, 'utf8')
expect(launcher).toContain('for %%I in ("%RESOURCES_DIR%\\..") do set "APP_DIR=%%~fI"')
expect(launcher).not.toContain('for %%I in ("%RESOURCES_DIR%..") do set "APP_DIR=%%~fI"')
})
})