remove force update files created by osu

This commit is contained in:
HorizonCode 2024-01-23 15:34:08 +01:00
parent 03b352bc15
commit 8c09719b43

22
main.js
View File

@ -27,7 +27,7 @@ const {
} = require("./electron/osuUtil"); } = require("./electron/osuUtil");
const { formatBytes } = require("./electron/formattingUtil"); const { formatBytes } = require("./electron/formattingUtil");
const windowName = require("get-window-by-name"); const windowName = require("get-window-by-name");
const { existsSync } = require("fs"); const fs = require("fs");
const { runFileDetached } = require("./electron/executeUtil"); const { runFileDetached } = require("./electron/executeUtil");
const richPresence = require("./electron/richPresence"); const richPresence = require("./electron/richPresence");
const cryptUtil = require("./electron/cryptoUtil"); const cryptUtil = require("./electron/cryptoUtil");
@ -68,7 +68,7 @@ function startOsuStatus() {
"EZPPLauncher", "EZPPLauncher",
"patcher.exe", "patcher.exe",
); );
if (existsSync(patcherExecuteable)) { if (fs.existsSync(patcherExecuteable)) {
runFileDetached(userOsuPath, patcherExecuteable); runFileDetached(userOsuPath, patcherExecuteable);
} }
} }
@ -483,6 +483,24 @@ function registerIPCPipes() {
await updateOsuConfigHashes(osuPath); await updateOsuConfigHashes(osuPath);
await replaceUIFile(osuPath, false); await replaceUIFile(osuPath, false);
const forceUpdateFiles = [
".require_update",
"help.txt",
"_pending",
];
//TODO: needs testing
try {
for (const updateFileName of forceUpdateFiles) {
const updateFile = path.join(osuPath, updateFileName);
if (fs.existsSync(updateFile)) {
await fs.promises.rm(updateFile, {
force: true,
recursive: (await fs.promises.lstat(updateFile)).isDirectory,
});
}
}
} catch {}
const userConfig = getUserConfig(osuPath); const userConfig = getUserConfig(osuPath);
richPresence.updateVersion(await userConfig.get("LastVersion")); richPresence.updateVersion(await userConfig.get("LastVersion"));
richPresence.update(); richPresence.update();