Skip to content

Commit

Permalink
Fix: clearer conflicting input files log message (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm authored Jan 19, 2024
1 parent bb378d3 commit a45ac47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/modules/candidateGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export default class CandidateGenerator extends Module {
.reduce(ArrayPoly.reduceUnique(), []);
if (conflictedInputFiles.length > 1) {
hasConflict = true;
let message = `Cannot ${this.options.writeString()} different files to: ${duplicateOutput}:`;
let message = `No single archive contains all necessary files, cannot ${this.options.writeString()} these different input files to: ${duplicateOutput}:`;
conflictedInputFiles.forEach((conflictedInputFile) => { message += `\n ${conflictedInputFile}`; });
this.progressBar.logWarn(message);
}
Expand Down
8 changes: 4 additions & 4 deletions test/modules/candidateGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ describe('with different input files for every game ROM', () => {
const filePromises = [
File.fileOf('one.rom', 1, { crc32: '12345678' }),
ArchiveEntry.entryOf(new Tar('1.tar'), '1.rom', 1, { crc32: '12345678' }), // duplicate
ArchiveEntry.entryOf(new Rar('a.7z'), 'a.rom', 2, { crc32: 'abcdef90' }),
ArchiveEntry.entryOf(new Rar('b.7z'), 'b.rom', 3, { crc32: '09876543' }),
ArchiveEntry.entryOf(new Rar('a.rar'), 'a.rom', 2, { crc32: 'abcdef90' }),
ArchiveEntry.entryOf(new Rar('b.rar'), 'b.rom', 3, { crc32: '09876543' }),
];

test.each(['zip', 'extract'])('should generate candidates when all ROMs for a game are in different files: %s', async (command) => {
Expand All @@ -368,7 +368,7 @@ describe('with different input files for every game ROM', () => {
// Then there should still be 3 parents, with the input -> output:
// (nothing) -> game with no ROMs
// one.rom -> game with one ROM
// a.7z|a.rom & b.7z|b.rom -> game with two ROMs (either in a folder or a zip, together)
// a.rar|a.rom & b.rar|b.rom -> game with two ROMs (either in a folder or a zip, together)
expect(parentsToCandidates.size).toEqual(3);
const candidates = [...parentsToCandidates.values()];

Expand Down Expand Up @@ -398,7 +398,7 @@ describe('with different input files for every game ROM', () => {
// Then there should still be 3 parents, with the input -> output:
// (nothing) -> game with no ROMs
// one.rom -> one.rom
// a.7z|a.rom & b.7z|b.rom -> game with two ROMs.7z -- CONFLICT!
// a.rar|a.rom & b.rar|b.rom -> game with two ROMs.rar -- CONFLICT!
// Because we're not extracting or zipping, two different input 7z files wanted to write to the
// same output file, which is a problem, so the parent resulted in no candidates
expect(parentsToCandidates.size).toEqual(3);
Expand Down

0 comments on commit a45ac47

Please sign in to comment.