fix: make the output *actually* crlf
This commit is contained in:
parent
9fa168c399
commit
937dee050d
15
index.ts
15
index.ts
@ -9,18 +9,19 @@ const readChart = async (fname: string) => {
|
|||||||
let res: string[] = [];
|
let res: string[] = [];
|
||||||
let isBPalette = false;
|
let isBPalette = false;
|
||||||
let isCorrectVersion = false;
|
let isCorrectVersion = false;
|
||||||
for(const line of data) {
|
for(let line of data) {
|
||||||
|
line = line.trimEnd();
|
||||||
if(line.startsWith('VERSION')) {
|
if(line.startsWith('VERSION')) {
|
||||||
if(line.trim() === 'VERSION\t1\t6\t0') {
|
if(line === 'VERSION\t1\t6\t0') {
|
||||||
res.push('VERSION\t1\t7\t0\r\n');
|
res.push('VERSION\t1\t7\t0');
|
||||||
isCorrectVersion = true;
|
isCorrectVersion = true;
|
||||||
}
|
}
|
||||||
} else if(line.startsWith('[')) {
|
} else if(line.startsWith('[')) {
|
||||||
isBPalette = line.trim() === '[B_PALETTE]';
|
isBPalette = line === '[B_PALETTE]';
|
||||||
res.push(line);
|
res.push(line);
|
||||||
} else if(isBPalette) {
|
} else if(isBPalette) {
|
||||||
if(line.trim().length > 0) {
|
if(line.length > 0) {
|
||||||
res.push(`${line.trim()}\t0\r\n`);
|
res.push(`${line}\t0`);
|
||||||
} else {
|
} else {
|
||||||
res.push(line);
|
res.push(line);
|
||||||
}
|
}
|
||||||
@ -33,7 +34,7 @@ const readChart = async (fname: string) => {
|
|||||||
console.log(`Skipped ${fname}`);
|
console.log(`Skipped ${fname}`);
|
||||||
} else {
|
} else {
|
||||||
g_count += 1;
|
g_count += 1;
|
||||||
await fs.writeFile(fname, res);
|
await fs.writeFile(fname, res.join('\r\n'));
|
||||||
console.log(`Updated ${fname}`);
|
console.log(`Updated ${fname}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user