UNPKG

igir

Version:

🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.

78 lines (77 loc) • 2.73 kB
import { ParsedPath } from 'node:path'; import DAT from './dats/dat.js'; import ROM from './dats/rom.js'; import SingleValueGame from './dats/singleValueGame.js'; import File from './files/file.js'; import Options from './options.js'; /** * A {@link ParsedPath} that carries {@link ArchiveEntry} path information. */ interface ParsedPathWithEntryPath extends ParsedPath { entryPath: string; } /** * A {@link ParsedPathWithEntryPath} that normalizes formatting across OSes. */ export declare class OutputPath implements ParsedPathWithEntryPath { base: string; dir: string; ext: string; /** * NOTE(cemmer): this class differs from {@link ParsedPath} crucially in that the "name" here * may contain {@link path.sep} in it on purpose. That's fine, because {@link path.format} handles * it gracefully. */ name: string; root: string; entryPath: string; constructor(parsedPath: ParsedPathWithEntryPath); /** * Format this {@link OutputPath}, similar to {@link path#format}. */ format(): string; } /** * A factory of static methods to generate output paths for a {@link ROM} and its related * {@link Game}. */ export default class OutputFactory { /** * Get the full output path for a ROM file. * @param options the {@link Options} instance for this run of igir. * @param dat the {@link DAT} that the ROM/{@link Game} is from. * @param game the {@link Game} that this file matches to. * @param rom a {@link ROM} from the {@link Game}. * @param inputFile a {@link File} that matches the {@link ROM}. * @param romBasenames the intended output basenames for every ROM from this {@link DAT}. */ static getPath(options: Options, dat: DAT, game: SingleValueGame, rom: ROM, inputFile: File, romBasenames?: string[]): OutputPath; /** ************************** * * File directory * * * ************************* */ static getDir(options: Options, dat: DAT, game?: SingleValueGame, inputFile?: File, romBasename?: string, romBasenames?: string[]): string; private static replaceTokensInOutputPath; private static replaceGameTokens; private static replaceDatTokens; private static replaceInputTokens; private static replaceOutputTokens; private static replaceOutputGameConsoleTokens; private static getDirLetterParsed; /** *********************************** * * File name and extension * * * ********************************* */ private static getName; private static getExt; private static getOutputFileBasename; private static getEntryPath; private static getRomBasename; } export {};