refactor: dedupe path lowercase helpers

This commit is contained in:
Peter Steinberger
2026-04-07 22:34:51 +01:00
parent 5a020cf9a1
commit b6970865b6
12 changed files with 41 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
import fs from "node:fs/promises";
import path from "node:path";
import { lowercasePreservingWhitespace } from "openclaw/plugin-sdk/text-runtime";
export async function pathExists(filePath: string): Promise<boolean> {
try {
@@ -12,5 +13,7 @@ export async function pathExists(filePath: string): Promise<boolean> {
export async function resolveArtifactKey(absolutePath: string): Promise<string> {
const canonicalPath = await fs.realpath(absolutePath).catch(() => path.resolve(absolutePath));
return process.platform === "win32" ? canonicalPath.toLowerCase() : canonicalPath;
return process.platform === "win32"
? lowercasePreservingWhitespace(canonicalPath)
: canonicalPath;
}