diff --git a/src/daemon/launchd.ts b/src/daemon/launchd.ts index 676f9101a..46d6b25e2 100644 --- a/src/daemon/launchd.ts +++ b/src/daemon/launchd.ts @@ -19,6 +19,7 @@ import type { GatewayServiceRuntime } from "./service-runtime.js"; import { resolveGatewayStateDir, resolveHomeDir } from "./paths.js"; const execFileAsync = promisify(execFile); +const toPosixPath = (value: string) => value.replace(/\\/g, "/"); const formatLine = (label: string, value: string) => { const rich = isRich(); @@ -35,8 +36,8 @@ function resolveLaunchAgentPlistPathForLabel( env: Record, label: string, ): string { - const home = resolveHomeDir(env); - return path.join(home, "Library", "LaunchAgents", `${label}.plist`); + const home = toPosixPath(resolveHomeDir(env)); + return path.posix.join(home, "Library", "LaunchAgents", `${label}.plist`); } export function resolveLaunchAgentPlistPath(env: Record): string { diff --git a/src/daemon/systemd.ts b/src/daemon/systemd.ts index 7566295d6..fef4eadd3 100644 --- a/src/daemon/systemd.ts +++ b/src/daemon/systemd.ts @@ -23,6 +23,7 @@ import { } from "./systemd-unit.js"; const execFileAsync = promisify(execFile); +const toPosixPath = (value: string) => value.replace(/\\/g, "/"); const formatLine = (label: string, value: string) => { const rich = isRich(); @@ -33,8 +34,8 @@ function resolveSystemdUnitPathForName( env: Record, name: string, ): string { - const home = resolveHomeDir(env); - return path.join(home, ".config", "systemd", "user", `${name}.service`); + const home = toPosixPath(resolveHomeDir(env)); + return path.posix.join(home, ".config", "systemd", "user", `${name}.service`); } function resolveSystemdServiceName(env: Record): string {