bondage-college-mirr/BondageClub/Tools/Node/FileCase.js
Jean-Baptiste Emmanuel Zorg 14123002b3 Make the tools error-free
Possibly the gulp minification pipeline is broken; I can't spare the
disk space — or the time — to run that at the moment. CI and the
changelog generator are fine though.

Only remains a few errors in AssetCheck, which look legitimate, but at
that point I'm done playing packaging games.
2025-01-25 22:35:14 +01:00

31 lines
680 B
JavaScript

import fs from "fs";
import { BASE_PATH, error } from "./Common.js";
/**
* @param {string} root
*/
function checkFileCasing(root) {
/** @type {Set<string>} */
const files = new Set();
/** @type {string[]} */
const invalid = [];
for (const _file of fs.readdirSync(root, { encoding: "utf8", recursive: true })) {
const file = _file.toLowerCase();
if (files.has(file)) {
invalid.push(_file);
}
files.add(file);
}
if (invalid.length) {
invalid.sort();
error(
`found ${invalid.length} duplicate files with different upper- and/or lower-casing: `
+ `${JSON.stringify(invalid, undefined, 4)}`,
);
}
}
(function () {
checkFileCasing(BASE_PATH);
}());