mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-23 10:51:02 +00:00
feat: implement archive deletion prompt and translations for confirmation messages
This commit is contained in:
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user