fix: normalize daemon unit paths
This commit is contained in:
@@ -19,6 +19,7 @@ import type { GatewayServiceRuntime } from "./service-runtime.js";
|
|||||||
import { resolveGatewayStateDir, resolveHomeDir } from "./paths.js";
|
import { resolveGatewayStateDir, resolveHomeDir } from "./paths.js";
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile);
|
const execFileAsync = promisify(execFile);
|
||||||
|
const toPosixPath = (value: string) => value.replace(/\\/g, "/");
|
||||||
|
|
||||||
const formatLine = (label: string, value: string) => {
|
const formatLine = (label: string, value: string) => {
|
||||||
const rich = isRich();
|
const rich = isRich();
|
||||||
@@ -35,8 +36,8 @@ function resolveLaunchAgentPlistPathForLabel(
|
|||||||
env: Record<string, string | undefined>,
|
env: Record<string, string | undefined>,
|
||||||
label: string,
|
label: string,
|
||||||
): string {
|
): string {
|
||||||
const home = resolveHomeDir(env);
|
const home = toPosixPath(resolveHomeDir(env));
|
||||||
return path.join(home, "Library", "LaunchAgents", `${label}.plist`);
|
return path.posix.join(home, "Library", "LaunchAgents", `${label}.plist`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveLaunchAgentPlistPath(env: Record<string, string | undefined>): string {
|
export function resolveLaunchAgentPlistPath(env: Record<string, string | undefined>): string {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
} from "./systemd-unit.js";
|
} from "./systemd-unit.js";
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile);
|
const execFileAsync = promisify(execFile);
|
||||||
|
const toPosixPath = (value: string) => value.replace(/\\/g, "/");
|
||||||
|
|
||||||
const formatLine = (label: string, value: string) => {
|
const formatLine = (label: string, value: string) => {
|
||||||
const rich = isRich();
|
const rich = isRich();
|
||||||
@@ -33,8 +34,8 @@ function resolveSystemdUnitPathForName(
|
|||||||
env: Record<string, string | undefined>,
|
env: Record<string, string | undefined>,
|
||||||
name: string,
|
name: string,
|
||||||
): string {
|
): string {
|
||||||
const home = resolveHomeDir(env);
|
const home = toPosixPath(resolveHomeDir(env));
|
||||||
return path.join(home, ".config", "systemd", "user", `${name}.service`);
|
return path.posix.join(home, ".config", "systemd", "user", `${name}.service`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveSystemdServiceName(env: Record<string, string | undefined>): string {
|
function resolveSystemdServiceName(env: Record<string, string | undefined>): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user