diff --git a/resources/js/helpers.js b/resources/js/helpers.js index a6c9653..8f46d76 100644 --- a/resources/js/helpers.js +++ b/resources/js/helpers.js @@ -111,20 +111,20 @@ async function openLatestDownload() { async function openGameFolder() { const config = await getCfg() - const folder = config.gameexe.match(/.*\\|.*\//g, '') + const folder = config.gameexe?.match(/.*\\|.*\//g, '') debug.log('Opening game folder: ', folder) - if (folder.length > 0) openInExplorer(folder[0].replace(/\//g, '\\')) + if (folder?.length > 0) openInExplorer(folder[0].replace(/\//g, '\\')) } async function openGrasscutterFolder() { const config = await getCfg() - const folder = config.serverFolder.match(/.*\\|.*\//g, '') + const folder = config.serverFolder?.match(/.*\\|.*\//g, '') debug.log('Opening grasscutter folder: ', folder) - if (folder.length > 0) openInExplorer(folder[0].replace(/\//g, '\\')) + if (folder?.length > 0) openInExplorer(folder[0].replace(/\//g, '\\')) } // https://www.jimzhao.us/2015/09/javascript-detect-chinese-character.html diff --git a/resources/js/index.js b/resources/js/index.js index 373f625..b50d6ba 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -284,13 +284,21 @@ async function openDownloads() { // Disable the resource download button if a serverFolder path is not set if (!config.serverFolder) { - debug.log('Server folder not set, disabling resource download button') + debug.log('Server folder not set, disabling resource download button and data download button') document.querySelector('#resourceInstall').disabled = true document.querySelector('#resourceInstall').classList.add('disabled') + + // Disable data installer + document.querySelector('#dataInstall').disabled = true + document.querySelector('#dataInstall').classList.add('disabled') } else { - debug.log('Server folder is set, enabling resource download button') + debug.log('Server folder is set, enabling resource download button and data download button') document.querySelector('#resourceInstall').disabled = false document.querySelector('#resourceInstall').classList.remove('disabled') + + // Enable data installer + document.querySelector('#dataInstall').disabled = false + document.querySelector('#dataInstall').classList.remove('disabled') } }