mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-01 11:31:54 +08:00
Refactor Stream Hosts
This commit is contained in:
@@ -12,6 +12,9 @@ async function compareAndWriteFile(linesA, filePath) {
|
||||
if (!fs.existsSync(filePath)) {
|
||||
console.log(`${filePath} does not exists, writing...`);
|
||||
isEqual = false;
|
||||
} else if (linesA.length === 0) {
|
||||
console.log(`Nothing to write to ${filePath}...`);
|
||||
isEqual = false;
|
||||
} else {
|
||||
let index = 0;
|
||||
|
||||
@@ -19,6 +22,12 @@ async function compareAndWriteFile(linesA, filePath) {
|
||||
const lineA = linesA[index];
|
||||
index++;
|
||||
|
||||
if (lineA === undefined) {
|
||||
// The file becomes smaller
|
||||
isEqual = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (lineA[0] === '#' && lineB[0] === '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user