GrassClipper/scripts/gcdownload.cmd

44 lines
1.1 KiB
Batchfile
Raw Normal View History

2022-05-02 02:09:10 +00:00
@echo off
set KEYSTORE_URL=%1
set ARTIFACT_URL=%2
set BRANCH=%3
set FOLDER_NAME=".\gc-%BRANCH%"
2022-05-02 02:34:10 +00:00
set FOLDER_NAME=%FOLDER_NAME:"=%
2022-05-02 02:09:10 +00:00
2022-05-02 02:34:10 +00:00
if not exist "%FOLDER_NAME%" mkdir "%FOLDER_NAME%"
2022-05-02 02:09:10 +00:00
if not exist ".\temp" mkdir ".\temp"
echo Downloading Grasscutter prebuilt jar...
:: Download the jar
powershell Invoke-WebRequest -Uri %KEYSTORE_URL% -OutFile "./temp/gcjar.zip"
echo Extracting...
2022-05-02 02:34:10 +00:00
:: Delete old file if there is one there
if exist "%FOLDER_NAME%\grasscutter.jar" del "%FOLDER_NAME%\grasscutter.jar"
2022-05-02 02:09:10 +00:00
2022-05-02 02:34:10 +00:00
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
)
2022-05-02 02:09:10 +00:00
echo Downloading keystore.p12...
2022-05-02 02:34:10 +00:00
:: Download the keystore.p12 file
2022-05-02 02:09:10 +00:00
powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12"
:: Remove temp stuff
del /s /q "./temp"
echo Done, latest Grasscutter %BRANCH% now downloaded in %FOLDER_NAME%
pause
exit /b