From 122e35c69b6b9f0b7e83f48cf7a9aa515b7464cf Mon Sep 17 00:00:00 2001 From: nanami-he <270413913+nanami-he@users.noreply.github.com> Date: Wed, 29 Apr 2026 19:24:28 +0900 Subject: [PATCH] fix(scripts): build-art path resolution on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `new URL(".", import.meta.url).pathname` returns "/C:/..." on Windows (POSIX-style with leading slash). join()-ing that with a relative segment produced "\C:\..." which fs() then failed to open with ENOENT. This blocked `bun run build` on Windows, which in turn blocked any local install that needs to regenerate dist/. Switched to `dirname(fileURLToPath(import.meta.url))` — same pattern the rest of the codebase already uses (cli/index.js, cli/openclaw-patch.ts). Surfaced while running the full build pipeline on Win11 to test the findPackageRoot fix from the same branch. --- scripts/build-art.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/build-art.ts b/scripts/build-art.ts index fe8a375..a3350b5 100644 --- a/scripts/build-art.ts +++ b/scripts/build-art.ts @@ -9,14 +9,17 @@ */ import { readFileSync, writeFileSync } from "fs"; -import { join } from "path"; +import { join, dirname } from "path"; +import { fileURLToPath } from "url"; import { ANIMAL_ART } from "../server/art.ts"; import { ANIMALS, ANIMAL_COLOR } from "../server/engine.ts"; import { ART_META } from "../server/art-meta.ts"; import type { AnimalId } from "../server/engine.ts"; -// Resolve paths relative to this script's directory -const SCRIPT_DIR = new URL(".", import.meta.url).pathname; +// Resolve paths relative to this script's directory. +// fileURLToPath gives a proper platform path; `new URL(...).pathname` returns +// "/C:/..." on Windows which breaks downstream join() calls. +const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)); const PROJECT_ROOT = join(SCRIPT_DIR, ".."); const SHELL_PATH = join(PROJECT_ROOT, "statusline", "pet-status.sh");