assurance check, that the launcher does not delete stuff directly in the osu folder

This commit is contained in:
HorizonCode 2024-04-23 08:55:00 +02:00
parent 80343bd929
commit 8a8856772e
1 changed files with 4 additions and 0 deletions

View File

@ -277,6 +277,10 @@ async function downloadEZPPLauncherUpdateFiles(osuPath, updateFiles) {
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)) {
//NOTE: check if the file is in the main osuPath folder, then dont delete.
if (path.dirname(filePath) == "osu!")
continue;
await fs.promises.rm(filePath, { recursive: true, force: true });
}
}