allow only a single instance, fix updating #2
22
main.js
22
main.js
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user