🐛 Fix patch verification

This commit is contained in:
C-3PO 2018-09-14 05:20:27 +02:00
parent b984512a75
commit 93c47e2fbc
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -15,7 +15,7 @@ export default function verifyPatch(fileEntries: ISsnFileEntry[], product: Produ
const validLastFileAlternate = `Assets/${product}_version.txt`; const validLastFileAlternate = `Assets/${product}_version.txt`;
if (lastFile.name === validLastFileName) { if (lastFile.name === validLastFileName) {
if (lastFile.diffType !== SsnDiffType.NewFile) { if (lastFile.diffType !== SsnDiffType.NewFile) {
throw new Error(`Last file (.version file) must have diffType 0 but it had diffType ${lastFile.diffType}.`); throw new Error(`Last file (.version file) must have diffType 0but it had diffType ${lastFile.diffType}.`);
} }
} else if (lastFile.name === validLastFileAlternate) { } else if (lastFile.name === validLastFileAlternate) {
//In some early patches, the last file is *_version.txt and the second to last is *.version //In some early patches, the last file is *_version.txt and the second to last is *.version
@ -29,8 +29,8 @@ export default function verifyPatch(fileEntries: ISsnFileEntry[], product: Produ
if (secondToLastFile.name !== validLastFileName) { if (secondToLastFile.name !== validLastFileName) {
throw new Error(`Last or second to last file must be called "${validLastFileName}" but it was "${secondToLastFile.name}".`); throw new Error(`Last or second to last file must be called "${validLastFileName}" but it was "${secondToLastFile.name}".`);
} }
if (secondToLastFile.diffType !== SsnDiffType.NewFile) { if (secondToLastFile.diffType !== SsnDiffType.Changed) {
throw new Error(`Second to last file (.version file) must have diffType 0 but it had diffType ${secondToLastFile.diffType}.`); throw new Error(`Second to last file (.version file) must have diffType 2 but it had diffType ${secondToLastFile.diffType}.`);
} }
} else { } else {
throw new Error(`Last file must be called "${validLastFileName}" or "${validLastFileAlternate}" but it was "${lastFile.name}".`); throw new Error(`Last file must be called "${validLastFileName}" or "${validLastFileAlternate}" but it was "${lastFile.name}".`);