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");