fix: make the output *actually* crlf

This commit is contained in:
あかニャン 2024-05-30 19:13:20 +09:00
parent 9fa168c399
commit 937dee050d

View File

@ -9,18 +9,19 @@ const readChart = async (fname: string) => {
let res: string[] = [];
let isBPalette = false;
let isCorrectVersion = false;
for(const line of data) {
for(let line of data) {
line = line.trimEnd();
if(line.startsWith('VERSION')) {
if(line.trim() === 'VERSION\t1\t6\t0') {
res.push('VERSION\t1\t7\t0\r\n');
if(line === 'VERSION\t1\t6\t0') {
res.push('VERSION\t1\t7\t0');
isCorrectVersion = true;
}
} else if(line.startsWith('[')) {
isBPalette = line.trim() === '[B_PALETTE]';
isBPalette = line === '[B_PALETTE]';
res.push(line);
} else if(isBPalette) {
if(line.trim().length > 0) {
res.push(`${line.trim()}\t0\r\n`);
if(line.length > 0) {
res.push(`${line}\t0`);
} else {
res.push(line);
}
@ -33,7 +34,7 @@ const readChart = async (fname: string) => {
console.log(`Skipped ${fname}`);
} else {
g_count += 1;
await fs.writeFile(fname, res);
await fs.writeFile(fname, res.join('\r\n'));
console.log(`Updated ${fname}`);
}
}