small bugfixes

This commit is contained in:
HorizonCode 2024-04-23 09:38:11 +02:00
parent 3bd1fb9edb
commit 9f9804f161
2 changed files with 21 additions and 6 deletions

View File

@ -277,11 +277,17 @@ async function downloadEZPPLauncherUpdateFiles(osuPath, updateFiles) {
//NOTE: check if the folder is not the osu root folder.
if (path.basename(pruneFolder) == "osu!")
continue;
for (const files of await fs.promises.readdir(pruneFolder)) {
const filePath = path.join(pruneFolder, files);
if (!updateFiles.some(file => path.join(osuPath, ...file.folder.split("/"), file.name) === filePath)) {
await fs.promises.rm(filePath, { recursive: true, force: true });
if (fs.existsSync(pruneFolder)) {
for (const files of await fs.promises.readdir(pruneFolder)) {
const filePath = path.join(pruneFolder, files);
if (!updateFiles.some(file => path.join(osuPath, ...file.folder.split("/"), file.name) === filePath)) {
eventEmitter.emit("data", {
fileName: path.basename(filePath),
});
try {
await fs.promises.rm(filePath, { recursive: true, force: true });
} catch { }
}
}
}
}

11
main.js
View File

@ -587,6 +587,15 @@ function registerIPCPipes() {
}/${formatBytes(data.total)})...`,
});
});
patcherDownloader.eventEmitter.on("delete", (data) => {
logger.log(`Deleting ${data.fileName}!`);
mainWindow.webContents.send("ezpplauncher:launchprogress", {
progress: -1,
});
mainWindow.webContents.send("ezpplauncher:launchstatus", {
status: `Deleting ${data.fileName}...`,
});
});
await patcherDownloader.startDownload();
mainWindow.webContents.send("ezpplauncher:launchprogress", {
progress: -1,
@ -664,7 +673,7 @@ function registerIPCPipes() {
if (fs.existsSync(updateFile)) {
await fs.promises.rm(updateFile, {
force: true,
recursive: (await fs.promises.lstat(updateFile)).isDirectory,
recursive: (await fs.promises.lstat(updateFile)).isDirectory(),
});
}
}