mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-26 17:51:08 +00:00
24 lines
867 B
JavaScript
24 lines
867 B
JavaScript
|
async function clearGCInstallation() {
|
||
|
Neutralino.os.execCommand(`del /s /q "./gc"`)
|
||
|
}
|
||
|
|
||
|
async function downloadGC(branch) {
|
||
|
const config = await getCfg()
|
||
|
|
||
|
// If we are pulling from a new branch, delete the old installation
|
||
|
if (config.grasscutterBranch !== branch) await clearGCInstallation()
|
||
|
|
||
|
// Keystore for branch (since they can differ)
|
||
|
const keystoreUrl = `https://github.com/Grasscutters/Grasscutter/raw/${branch}/keystore.p12`
|
||
|
|
||
|
// External service that allows un-authed artifact downloading
|
||
|
const artiUrl = `https://nightly.link/Grasscutters/Grasscutter/workflows/build/${branch}/Grasscutter.zip`
|
||
|
|
||
|
// Run installer
|
||
|
createCmdWindow(`.\\scripts\\gcdownload.cmd ${artiUrl} ${keystoreUrl} ${branch}`)
|
||
|
|
||
|
// Set current installation in config
|
||
|
config.grasscutterBranch = branch
|
||
|
|
||
|
Neutralino.storage.setData('config', JSON.stringify(config))
|
||
|
}
|