From 9307d7709cc4f55339b9fe08ba9a7fd4312e542d Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Fri, 24 Nov 2023 07:26:42 +0100 Subject: [PATCH] fix checkbox --- app.js | 8 ++++---- preload/preload.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 196ceeb..35aa1b1 100644 --- a/app.js +++ b/app.js @@ -14,6 +14,7 @@ const appInfo = require('./appInfo'); const executeUtil = require("./executeUtil"); const { DownloaderHelper } = require('node-downloader-helper'); +let shouldPatch = false; let patcherLoc = undefined; let tempOsuPath; let osuWindowInfo; @@ -40,7 +41,7 @@ const run = () => { //TODO: do patch setTimeout(() => { console.log("yes"); - if (patcherLoc) { + if (shouldPatch) { console.log("running " + patcherLoc + " in dir " + path.dirname(patcherLoc)); executeUtil.runFileDetached(path.dirname(patcherLoc), patcherLoc); } @@ -226,10 +227,9 @@ const run = () => { }) ipcMain.handle('launch', async (e, opts) => { console.log(opts); - const patch = "patch" in opts && opts.patch; + shouldPatch = "patch" in opts && opts.patch; const osuFolder = await config.get("osuPath"); - if (patch) patcherLoc = path.join(osuFolder, "EZPPLauncher", "patcher.exe"); - else patcherLoc = undefined; + patcherLoc = path.join(osuFolder, "EZPPLauncher", "patcher.exe"); await osuUtil.updateOsuCfg(path.join(osuFolder, "osu!.cfg")); const osuConfig = await osuUtil.getLatestConfig(tempOsuPath); diff --git a/preload/preload.js b/preload/preload.js index 0c9246b..ec676bb 100644 --- a/preload/preload.js +++ b/preload/preload.js @@ -48,7 +48,7 @@ window.addEventListener('DOMContentLoaded', () => { case "up-to-date": $("#launch-btn").attr('disabled', true); $('#launch-btn').html('Launching...'); - const result = await ipcRenderer.invoke("launch", { patch: true }); + const result = await ipcRenderer.invoke("launch", { patch: $('#enablePatching').is(':checked') }); if (!result) { Swal.fire({ title: 'Uh oh!',