Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Commit

Permalink
disable data downloader when gc folder not set
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed May 8, 2022
1 parent fecd82f commit 2ded1f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions resources/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions resources/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}

Expand Down

0 comments on commit 2ded1f6

Please sign in to comment.