feat: implement archive deletion prompt and translations for confirmation messages

This commit is contained in:
Moyasee
2025-12-12 12:44:02 +02:00
parent 0470958629
commit 63f8289d0a
12 changed files with 127 additions and 23 deletions

View File

@@ -116,17 +116,15 @@ export class GameFilesManager {
}
}
for (const file of compressedFiles) {
const extractionPath = path.join(directoryPath, file);
const archivePaths = compressedFiles
.map((file) => path.join(directoryPath, file))
.filter((archivePath) => fs.existsSync(archivePath));
try {
if (fs.existsSync(extractionPath)) {
await fs.promises.unlink(extractionPath);
logger.info(`Deleted archive: ${file}`);
}
} catch (err) {
logger.error(`Failed to delete file: ${file}`, err);
}
if (archivePaths.length > 0) {
WindowManager.mainWindow?.webContents.send(
"on-archive-deletion-prompt",
archivePaths
);
}
}
@@ -186,12 +184,10 @@ export class GameFilesManager {
await this.extractFilesInDirectory(extractionPath);
if (fs.existsSync(extractionPath) && fs.existsSync(filePath)) {
try {
await fs.promises.unlink(filePath);
logger.info(`Deleted archive: ${download.folderName}`);
} catch (err) {
logger.error(`Failed to delete file: ${download.folderName}`, err);
}
WindowManager.mainWindow?.webContents.send(
"on-archive-deletion-prompt",
[filePath]
);
}
await downloadsSublevel.put(this.gameKey, {