refactor(daemon): reuse shared path normalizer

This commit is contained in:
Ayaan Zaidi
2026-05-02 16:08:16 +05:30
parent 0d747536de
commit 626a22decb

View File

@@ -1,13 +1,10 @@
import path from "node:path";
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
function getPathModule(platform: NodeJS.Platform) {
return platform === "win32" ? path.win32 : path.posix;
}
function normalizeLowercaseStringOrEmpty(value: string | undefined): string {
return value?.trim().toLowerCase() ?? "";
}
export function normalizeServicePathEntry(entry: string, platform: NodeJS.Platform): string {
const pathModule = getPathModule(platform);
const normalized = pathModule.normalize(entry).replaceAll("\\", "/");