🎨 Even for newly added files, use .tmp file extension
This commit is contained in:
parent
110be7f94c
commit
69759e5709
1 changed files with 9 additions and 2 deletions
|
@ -83,13 +83,20 @@ export default async function getPatch({ product, from, to, sourceDirectory, tar
|
||||||
try {
|
try {
|
||||||
//create file write stream
|
//create file write stream
|
||||||
const outputName = path.join(targetDir, file.name);
|
const outputName = path.join(targetDir, file.name);
|
||||||
await createDirRecursively(path.dirname(outputName));
|
const outputNameTemp = path.join(targetDir, `${file.name}.tmp`);
|
||||||
const outputStream = fs.createWriteStream(outputName);
|
await createDirRecursively(path.dirname(outputNameTemp));
|
||||||
|
const outputStream = fs.createWriteStream(outputNameTemp);
|
||||||
|
|
||||||
//start installation
|
//start installation
|
||||||
await launch(diskFilenames[file.diskNumberStart], file.offset, file.compressedSize, file.decryptionKeys, undefined, outputStream);
|
await launch(diskFilenames[file.diskNumberStart], file.offset, file.compressedSize, file.decryptionKeys, undefined, outputStream);
|
||||||
|
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|
||||||
|
fs.rename(outputNameTemp, outputName, (renameError) => {
|
||||||
|
if (renameError) {
|
||||||
|
throw new Error(`Could not rename output file "${outputNameTemp}": ${renameError.name}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Could not extract file "${file.name}"`, error);
|
console.error(`Could not extract file "${file.name}"`, error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue