in src/controller/addonController.ts [285:323]
private async extractAddon(
compressedFilePath: string,
addonVersionFolderPath: string
) {
// if the directory exists, ask to overwrite.
if (!(await this.dirExistsOrMake(addonVersionFolderPath))) {
try {
await AddonView.promptOverwrite();
} catch {
await fs.promises.unlink(compressedFilePath);
return;
}
}
await extract(compressedFilePath, {
dir: addonVersionFolderPath,
});
await fs.promises.unlink(compressedFilePath);
if (!fs.existsSync(addonVersionFolderPath)) {
const errorMessages: ErrorMessages = {
window: {
other: `Extraction failed. Could not find ${addonVersionFolderPath}.`,
},
thrown: {
other: "Extraction failed.",
},
};
return await NotificationView.showErrorMessage(
errorMessages,
"other",
this.extractAddon,
[compressedFilePath, addonVersionFolderPath]
);
}
vscode.window.showInformationMessage("Extraction complete.");
}