Fix error prompted when uninstalling BSIPA but in fact was successfully uninstalled (#973)

This commit is contained in:
Zagrios
2025-12-06 23:39:38 +01:00
committed by GitHub
parent 58f8d8e243
commit 6d19d21116
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ export async function deleteFile(filepath: string) {
log.info("Deleting file", `"${filepath}"`);
await unlink(filepath);
} catch (error: any) {
log.error("Could not delete file", `"${filepath}"`);
log.error("Could not delete file", `"${filepath}"`, error);
throw CustomError.fromError(error, "generic.fs.delete-file");
}
}
@@ -42,7 +42,7 @@ export function deleteFileSync(filepath: string) {
log.info("Deleting file", `"${filepath}"`);
unlinkSync(filepath);
} catch (error: any) {
log.error("Could not delete file", `"${filepath}"`);
log.error("Could not delete file", `"${filepath}"`, error);
throw CustomError.fromError(error, "generic.fs.delete-file");
}
}
@@ -329,7 +329,9 @@ export class BsModsManagerService {
const promises = mod.version.contentHashes.map(content => {
const file = content.path.replaceAll("IPA/", "").replaceAll("Data", "Beat Saber_Data");
return deleteFile(path.join(verionPath, file));
return deleteFile(path.join(verionPath, file)).catch(err => {
log.info("Unable to delete IPA file, likely because it has been removed by the --revert command. Here is the error:", err);
});
});
await Promise.all(promises);