fix gc downloader script

This commit is contained in:
SpikeHD 2022-05-01 19:34:10 -07:00
parent 121581e460
commit e6642c8971
2 changed files with 15 additions and 3 deletions

View File

@ -20,5 +20,8 @@ async function downloadGC(branch) {
// Set current installation in config // Set current installation in config
config.grasscutterBranch = branch config.grasscutterBranch = branch
// Set gc path for people with launcher enabled
config.serverFolder = `${NL_CWD}\\gc-${branch}\\`
Neutralino.storage.setData('config', JSON.stringify(config)) Neutralino.storage.setData('config', JSON.stringify(config))
} }

View File

@ -4,8 +4,9 @@ set KEYSTORE_URL=%1
set ARTIFACT_URL=%2 set ARTIFACT_URL=%2
set BRANCH=%3 set BRANCH=%3
set FOLDER_NAME=".\gc-%BRANCH%" 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" if not exist ".\temp" mkdir ".\temp"
echo Downloading Grasscutter prebuilt jar... echo Downloading Grasscutter prebuilt jar...
@ -15,12 +16,20 @@ powershell Invoke-WebRequest -Uri %KEYSTORE_URL% -OutFile "./temp/gcjar.zip"
echo Extracting... 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... echo Downloading keystore.p12...
:: Download the keystore.p12 file
powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12" powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12"
:: Remove temp stuff :: Remove temp stuff