judge.vj4: run dos2unix for input files

This commit is contained in:
undefined committed 2021-03-13 22:39:52 +08:00
1 parent 408be70ce5
commit 26206d36cc
2 files changed
+11 -2

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.4.11",
"version": "2.4.12",
"os": [
"linux"
],
+10 -1
View File
@@ -385,7 +385,16 @@ export default class VJ4 {
else if (i.toLowerCase() === 'output') await fs.rename(`${folder}/${i}`, `${folder}/output`);
}
files = await fs.readdir(`${folder}/input`);
for (const i of files) await fs.rename(`${folder}/input/${i}`, `${folder}/input/${i.toLowerCase()}`);
for (const i of files) {
if (fs.statSync(`${folder}/input/${i}`).size > 64 * 1024 * 1024) {
await fs.rename(`${folder}/input/${i}`, `${folder}/input/${i.toLowerCase()}`);
} else {
const buffer = await fs.readFile(`${folder}/input/${i}`);
const data = buffer.toString().replace(/\r/g, '');
await fs.unlink(`${folder}/input/${i}`);
await fs.writeFile(`${folder}/input/${i.toLowerCase()}`, data);
}
}
files = await fs.readdir(`${folder}/output`);
for (const i of files) await fs.rename(`${folder}/output/${i}`, `${folder}/output/${i.toLowerCase()}`);
}