mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-16 04:45:34 +00:00
resource downloader (fr this time)
This commit is contained in:
parent
1430e979a0
commit
1e197005e3
55
scripts/gc_download.cmd
Normal file
55
scripts/gc_download.cmd
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set KEYSTORE_URL=%1
|
||||||
|
set ARTIFACT_URL=%2
|
||||||
|
set BRANCH=%3
|
||||||
|
set FOLDER_NAME=".\gc-%BRANCH%"
|
||||||
|
set FOLDER_NAME=%FOLDER_NAME:"=%
|
||||||
|
|
||||||
|
title GC Download Script
|
||||||
|
|
||||||
|
if not exist "%FOLDER_NAME%" mkdir "%FOLDER_NAME%"
|
||||||
|
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...
|
||||||
|
|
||||||
|
:: Delete old file if there is one there
|
||||||
|
if exist "%FOLDER_NAME%\grasscutter.jar" del "%FOLDER_NAME%\grasscutter.jar"
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
:: Allow resource downloading to be optional, since it takes a while
|
||||||
|
set REPLY=y
|
||||||
|
set /p "REPLY=Download server resources? (This can take a while) [y|n]:"
|
||||||
|
if /i not "%reply%" == "y" goto :finish
|
||||||
|
|
||||||
|
call .\scripts\resources_download.cmd %FOLDER_NAME%
|
||||||
|
|
||||||
|
goto :finish
|
||||||
|
|
||||||
|
:finish
|
||||||
|
:: Remove temp stuff
|
||||||
|
del /s /q "./temp"
|
||||||
|
|
||||||
|
echo Done, latest Grasscutter %BRANCH% now downloaded in %FOLDER_NAME%
|
||||||
|
|
||||||
|
pause
|
||||||
|
|
||||||
|
taskkill /f /fi "WINDOWTITLE eq GC Download Script"
|
||||||
|
|
29
scripts/resources_download.cmd
Normal file
29
scripts/resources_download.cmd
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set FOLDER_NAME=%1
|
||||||
|
set FOLDER_NAME=%FOLDER_NAME:"=%
|
||||||
|
|
||||||
|
if not exist ".\temp" mkdir ".\temp"
|
||||||
|
if not exist ".\resources" mkdir ".\resources"
|
||||||
|
|
||||||
|
echo Downloading resources, this can take a while...
|
||||||
|
|
||||||
|
:: Grab the giant ass resource zip
|
||||||
|
powershell Invoke-WebRequest -Uri https://github.com/Koko-boya/Grasscutter_Resources/archive/refs/heads/main.zip -OutFile "./temp/resources.zip"
|
||||||
|
|
||||||
|
echo Extracting...
|
||||||
|
|
||||||
|
:: Extract resources to the folder
|
||||||
|
powershell Expand-Archive -Path "./temp/resources.zip" -DestinationPath "%FOLDER_NAME%" -Force
|
||||||
|
|
||||||
|
:: Delete old resources folder if there is one there
|
||||||
|
del /s /q "%FOLDER_NAME%\resources">nul
|
||||||
|
|
||||||
|
echo Moving resources to folder...
|
||||||
|
|
||||||
|
robocopy "%FOLDER_NAME%\Grasscutter_Resources-main\Resources" "%FOLDER_NAME%\resources" /E /MOVE>nul
|
||||||
|
|
||||||
|
:: Delete straggling files
|
||||||
|
del /s /q "%FOLDER_NAME%\Grasscutter_Resources-main"
|
||||||
|
|
||||||
|
echo Done, resources should be properly extracted
|
Loading…
Reference in New Issue
Block a user