fix checkbox

This commit is contained in:
HorizonCode 2023-11-24 07:26:42 +01:00
parent 58fa4a6329
commit 9307d7709c
2 changed files with 5 additions and 5 deletions

8
app.js
View File

@ -14,6 +14,7 @@ const appInfo = require('./appInfo');
const executeUtil = require("./executeUtil"); const executeUtil = require("./executeUtil");
const { DownloaderHelper } = require('node-downloader-helper'); const { DownloaderHelper } = require('node-downloader-helper');
let shouldPatch = false;
let patcherLoc = undefined; let patcherLoc = undefined;
let tempOsuPath; let tempOsuPath;
let osuWindowInfo; let osuWindowInfo;
@ -40,7 +41,7 @@ const run = () => {
//TODO: do patch //TODO: do patch
setTimeout(() => { setTimeout(() => {
console.log("yes"); console.log("yes");
if (patcherLoc) { if (shouldPatch) {
console.log("running " + patcherLoc + " in dir " + path.dirname(patcherLoc)); console.log("running " + patcherLoc + " in dir " + path.dirname(patcherLoc));
executeUtil.runFileDetached(path.dirname(patcherLoc), patcherLoc); executeUtil.runFileDetached(path.dirname(patcherLoc), patcherLoc);
} }
@ -226,10 +227,9 @@ const run = () => {
}) })
ipcMain.handle('launch', async (e, opts) => { ipcMain.handle('launch', async (e, opts) => {
console.log(opts); console.log(opts);
const patch = "patch" in opts && opts.patch; shouldPatch = "patch" in opts && opts.patch;
const osuFolder = await config.get("osuPath"); const osuFolder = await config.get("osuPath");
if (patch) patcherLoc = path.join(osuFolder, "EZPPLauncher", "patcher.exe"); patcherLoc = path.join(osuFolder, "EZPPLauncher", "patcher.exe");
else patcherLoc = undefined;
await osuUtil.updateOsuCfg(path.join(osuFolder, "osu!.cfg")); await osuUtil.updateOsuCfg(path.join(osuFolder, "osu!.cfg"));
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath); const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);

View File

@ -48,7 +48,7 @@ window.addEventListener('DOMContentLoaded', () => {
case "up-to-date": case "up-to-date":
$("#launch-btn").attr('disabled', true); $("#launch-btn").attr('disabled', true);
$('#launch-btn').html('Launching...'); $('#launch-btn').html('Launching...');
const result = await ipcRenderer.invoke("launch", { patch: true }); const result = await ipcRenderer.invoke("launch", { patch: $('#enablePatching').is(':checked') });
if (!result) { if (!result) {
Swal.fire({ Swal.fire({
title: 'Uh oh!', title: 'Uh oh!',