From 84c13331d2141d7e50744575dd1ced136f40d712 Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Thu, 27 Oct 2022 15:42:45 +0200 Subject: [PATCH] add launch button folder choose if not set --- preload/preload.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/preload/preload.js b/preload/preload.js index 0fe0882..0b8bed6 100644 --- a/preload/preload.js +++ b/preload/preload.js @@ -16,7 +16,6 @@ window.addEventListener('DOMContentLoaded', () => { titlebar.updateTitle(`${appInfo.appName} ${appInfo.appVersion}`); const $ = require('jquery'); - const axios = require('axios').default; const Swal = require('sweetalert2'); $('#account-action').on('click', () => { @@ -69,6 +68,28 @@ window.addEventListener('DOMContentLoaded', () => { $('#launch-btn').html('Updating...'); ipcRenderer.send("do-update"); break; + case "missing-folder": + const responseData = await ipcRenderer.invoke('set-osu-dir'); + if (!responseData) + return; + if (responseData.validOsuDir) { + Swal.fire({ + title: 'Success!', + text: 'osu! folder set.', + icon: 'success', + confirmButtonText: 'Cool' + }) + $('#currentOsuPath').text(responseData.folderPath); + ipcRenderer.send("do-update-check"); + } else { + Swal.fire({ + title: 'Uh oh!', + text: 'The selected folder is not a osu! directory.', + icon: 'error', + confirmButtonText: 'Oops.. my bad!' + }) + } + break; } }); @@ -157,7 +178,7 @@ window.addEventListener('DOMContentLoaded', () => { currentState = status.type; break; case "missing-folder": - $("#launch-btn").attr('disabled', true); + $("#launch-btn").attr('disabled', false); $('#launch-btn').html('set your osu! folder'); currentState = status.type; break;