From 158e10352b1094322b54d11c8c26d3445fe52b42 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 19:34:10 -0700 Subject: [PATCH] fix gc downloader script --- resources/js/gcdownloader.js | 3 +++ scripts/gcdownload.cmd | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index c1b5e1b..0786abe 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -20,5 +20,8 @@ async function downloadGC(branch) { // Set current installation in config config.grasscutterBranch = branch + // Set gc path for people with launcher enabled + config.serverFolder = `${NL_CWD}\\gc-${branch}\\` + Neutralino.storage.setData('config', JSON.stringify(config)) } \ No newline at end of file diff --git a/scripts/gcdownload.cmd b/scripts/gcdownload.cmd index 9105de2..3c6c05d 100644 --- a/scripts/gcdownload.cmd +++ b/scripts/gcdownload.cmd @@ -4,8 +4,9 @@ set KEYSTORE_URL=%1 set ARTIFACT_URL=%2 set BRANCH=%3 set FOLDER_NAME=".\gc-%BRANCH%" +set FOLDER_NAME=%FOLDER_NAME:"=% -if not exist %FOLDER_NAME% mkdir %FOLDER_NAME% +if not exist "%FOLDER_NAME%" mkdir "%FOLDER_NAME%" if not exist ".\temp" mkdir ".\temp" echo Downloading Grasscutter prebuilt jar... @@ -15,12 +16,20 @@ powershell Invoke-WebRequest -Uri %KEYSTORE_URL% -OutFile "./temp/gcjar.zip" echo Extracting... -powershell Expand-Archive -Path "./temp/gcjar.zip" -DestinationPath %FOLDER_NAME% -Force +:: Delete old file if there is one there +if exist "%FOLDER_NAME%\grasscutter.jar" del "%FOLDER_NAME%\grasscutter.jar" -:: Download the keystore.p12 file +powershell Expand-Archive -Path "./temp/gcjar.zip" -DestinationPath "%FOLDER_NAME%" -Force + +:: Find the jar file name and rename it, just in case +for %%i in (%FOLDER_NAME%/*) do ( + :: If the extension is jar, rename the file + if %%~xi equ .jar rename "%FOLDER_NAME%\%%i" grasscutter.jar +) echo Downloading keystore.p12... +:: Download the keystore.p12 file powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12" :: Remove temp stuff