feat: adding icon parser to download notification

This commit is contained in:
Chubby Granny Chaser 2024-06-05 20:15:59 +01:00
parent 6b8ab895e3
commit 4a4a800b07
No known key found for this signature in database
17 changed files with 343 additions and 146 deletions

View file

@ -34,33 +34,32 @@ const deleteGameFolder = async (
game.folderName
);
if (!fs.existsSync(folderPath)) {
await gameRepository.update(
{ id: gameId },
{ downloadPath: null, folderName: null }
);
}
if (fs.existsSync(folderPath)) {
await new Promise<void>((resolve, reject) => {
fs.rm(
folderPath,
{ recursive: true, force: true, maxRetries: 5, retryDelay: 200 },
(error) => {
if (error) {
logger.error(error);
reject();
}
return new Promise<void>((resolve, reject) => {
fs.rm(
folderPath,
{ recursive: true, force: true, maxRetries: 5, retryDelay: 200 },
(error) => {
if (error) {
logger.error(error);
reject();
const aria2ControlFilePath = `${folderPath}.aria2`;
if (fs.existsSync(aria2ControlFilePath))
fs.rmSync(aria2ControlFilePath);
resolve();
}
resolve();
}
);
}).then(async () => {
await gameRepository.update(
{ id: gameId },
{ downloadPath: null, folderName: null }
);
});
);
});
}
}
await gameRepository.update(
{ id: gameId },
{ downloadPath: null, folderName: null, status: null, progress: 0 }
);
};
registerEvent("deleteGameFolder", deleteGameFolder);