Skip to content

Commit

Permalink
Fix: don't consider input files as moved when write failed (#1156)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm authored Jun 11, 2024
1 parent ed1f267 commit 52bfae1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/modules/candidateWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ export default class CandidateWriter extends Module {
}
}

let written = false;
for (let i = 0; i <= this.options.getWriteRetry(); i += 1) {
const written = await this.writeZipFile(
written = await this.writeZipFile(
dat,
releaseCandidate,
outputZip,
Expand Down Expand Up @@ -235,6 +236,9 @@ export default class CandidateWriter extends Module {
}
}
}
if (!written) {
return;
}

inputToOutputZipEntries.forEach(([inputRomFile]) => this.enqueueFileDeletion(inputRomFile));
}
Expand Down Expand Up @@ -439,8 +443,9 @@ export default class CandidateWriter extends Module {
}
}

let written = false;
for (let i = 0; i <= this.options.getWriteRetry(); i += 1) {
const written = await this.writeRawFile(dat, releaseCandidate, inputRomFile, outputFilePath);
written = await this.writeRawFile(dat, releaseCandidate, inputRomFile, outputFilePath);

if (written && !this.options.shouldTest()) {
// Successfully written, unknown if valid
Expand All @@ -466,6 +471,10 @@ export default class CandidateWriter extends Module {
}
}
}
if (!written) {
return;
}

this.enqueueFileDeletion(inputRomFile);
}

Expand Down

0 comments on commit 52bfae1

Please sign in to comment.