fix(daemon): decompose win-unpacked layout paths with win32 semantics

buildDaemonHostManifest processes Windows packaged-layout source paths, but used
ambient node:path — so its unit test (which feeds hardcoded C:\ paths) produced
wrong destRels on the Linux CI verify runner, where \ is not a separator. Use
path.win32 for the pure relative/dirname decomposition (win32 accepts both / and
\ and understands drive letters, so it's correct for Windows AND POSIX inputs),
while keeping ambient join/dirname for every path that touches the real
filesystem so the materialize tests stay host-native on Linux. Win32 runtime
behavior is unchanged (path === path.win32 there).
This commit is contained in:
Jinwoo Hong
2026-07-06 23:12:54 -04:00
parent 495208e6f3
commit e48ab4dd20
+7 -4
View File
@@ -9,7 +9,7 @@ import {
rmSync,
writeFileSync
} from 'node:fs'
import { dirname, join, relative, sep } from 'node:path'
import { dirname, join, win32 as winPath } from 'node:path'
import { app } from 'electron'
import { parseDaemonPidFile, startTimeMatches } from './daemon-health'
@@ -79,8 +79,11 @@ type MaterializeMarker = {
entryRelPath: string
}
// Uses win32 path semantics so Windows layout paths (drive letters, `\`)
// decompose correctly regardless of host OS — needed for cross-platform unit
// tests; production runs this on win32 only.
function toPosixRelative(fromDir: string, absPath: string): string {
return relative(fromDir, absPath).split(sep).join('/')
return winPath.relative(fromDir, absPath).split(winPath.sep).join('/')
}
function destPath(root: string, destRel: string): string {
@@ -109,7 +112,7 @@ function collectDaemonHostSources(): DaemonHostSources | null {
return null
}
const execPath = process.execPath
const appDir = dirname(execPath)
const appDir = winPath.dirname(execPath)
const entrySourcePath = resolveEntrySourcePath(resourcesPath)
return {
appDir,
@@ -158,7 +161,7 @@ export function buildDaemonHostManifest(
// Daemon bundle: entry + its sibling chunks/ + the unpacked out/package.json
// (CJS/ESM loader resolution), mirrored verbatim.
ops.push({ sourcePath: entrySourcePath, destRel: entryRelPath, kind: 'file' })
const chunksDir = join(dirname(entrySourcePath), 'chunks')
const chunksDir = join(winPath.dirname(entrySourcePath), 'chunks')
ops.push({
sourcePath: chunksDir,
destRel: toPosixRelative(appDir, chunksDir),