20 lines
617 B
TypeScript
20 lines
617 B
TypeScript
import fs from "fs";
|
|
import type { Wordlist } from "./scanning-source-files.js";
|
|
|
|
/**
|
|
* Takes a list of scanned datasets and creates their output folders if missing.
|
|
*/
|
|
export function ensureOutputFolders(wordlists: Wordlist[]): void {
|
|
for (const wordlist of wordlists) {
|
|
if (!fs.existsSync(wordlist.outputDir)) {
|
|
fs.mkdirSync(wordlist.outputDir, { recursive: true });
|
|
console.log(
|
|
`📁 Created target folder: worddata/${wordlist.language}/${wordlist.pos}`,
|
|
);
|
|
}
|
|
}
|
|
|
|
console.log(
|
|
"✅ All required output directories have been verified and created successfully.",
|
|
);
|
|
}
|