mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-16 04:45:34 +00:00
disable data downloader when gc folder not set
This commit is contained in:
parent
fecd82fe75
commit
2ded1f69ae
@ -111,20 +111,20 @@ async function openLatestDownload() {
|
|||||||
|
|
||||||
async function openGameFolder() {
|
async function openGameFolder() {
|
||||||
const config = await getCfg()
|
const config = await getCfg()
|
||||||
const folder = config.gameexe.match(/.*\\|.*\//g, '')
|
const folder = config.gameexe?.match(/.*\\|.*\//g, '')
|
||||||
|
|
||||||
debug.log('Opening game folder: ', folder)
|
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() {
|
async function openGrasscutterFolder() {
|
||||||
const config = await getCfg()
|
const config = await getCfg()
|
||||||
const folder = config.serverFolder.match(/.*\\|.*\//g, '')
|
const folder = config.serverFolder?.match(/.*\\|.*\//g, '')
|
||||||
|
|
||||||
debug.log('Opening grasscutter folder: ', folder)
|
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
|
// https://www.jimzhao.us/2015/09/javascript-detect-chinese-character.html
|
||||||
|
@ -284,13 +284,21 @@ async function openDownloads() {
|
|||||||
|
|
||||||
// Disable the resource download button if a serverFolder path is not set
|
// Disable the resource download button if a serverFolder path is not set
|
||||||
if (!config.serverFolder) {
|
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').disabled = true
|
||||||
document.querySelector('#resourceInstall').classList.add('disabled')
|
document.querySelector('#resourceInstall').classList.add('disabled')
|
||||||
|
|
||||||
|
// Disable data installer
|
||||||
|
document.querySelector('#dataInstall').disabled = true
|
||||||
|
document.querySelector('#dataInstall').classList.add('disabled')
|
||||||
} else {
|
} 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').disabled = false
|
||||||
document.querySelector('#resourceInstall').classList.remove('disabled')
|
document.querySelector('#resourceInstall').classList.remove('disabled')
|
||||||
|
|
||||||
|
// Enable data installer
|
||||||
|
document.querySelector('#dataInstall').disabled = false
|
||||||
|
document.querySelector('#dataInstall').classList.remove('disabled')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user