import { promises as fs } from "node:fs"; import path from "node:path"; export function catalogueAssetDirectories( gamedataRoot: string, cwd = process.cwd(), ): string[] { const bundled = path.join(cwd, "public", "swf", "c_images", "catalogue"); if (!gamedataRoot.trim()) return [bundled]; return [path.join(gamedataRoot, "c_images", "catalogue"), bundled]; } export async function readCatalogueAssetFiles( directories: string[], ): Promise { const files = new Set(); for (const directory of directories) { try { for (const file of await fs.readdir(directory)) files.add(file); } catch { // A missing optional source must not hide assets from the other source. } } return [...files]; }