代码拉取完成,页面将自动刷新
@echo off
rem ============================================================================
rem -- Set up environment ------------------------------------------------------
rem ============================================================================
set SCRIPT_DIR=%~dp0
set CONTENT_FOLDER=%SCRIPT_DIR%Unreal/CarlaUE4/Content/Carla
set VERSION_FILE=%CONTENT_FOLDER%/.version
set CONTENT_VERSIONS=%SCRIPT_DIR%/Util/ContentVersions.txt
rem ============================================================================
rem -- Get the last version to download ----------------------------------------
rem ============================================================================
if not exist "%CONTENT_FOLDER%" mkdir "%CONTENT_FOLDER%"
for /F "delims=" %%a in (%CONTENT_VERSIONS%) do (
set "lastLine=%%a"
)
set CONTENT_ID=%lastLine:~-16,16%
set CONTENT_LINK=https://carla-assets.s3.us-east-005.backblazeb2.com/%CONTENT_ID%.tar.gz
if "%CONTENT_ID:~0,2%"=="20" (
set CONTENT_FILE=%CONTENT_FOLDER%/%CONTENT_ID%.tar.gz
set CONTENT_FILE_TAR=%CONTENT_FOLDER%/%CONTENT_ID%.tar
echo %CONTENT_ID%
echo %CONTENT_LINK%
) else (
echo Error reading the latest version from ContentVersions.txt, check last line of file %CONTENT_VERSIONS%'
goto error_download
)
rem ============================================================================
rem -- Download the content ----------------------------------------------------
rem ============================================================================
echo Downloading "%CONTENT_LINK%"...
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%CONTENT_LINK%', '%CONTENT_FILE%')"
if %errorlevel% neq 0 goto error_download
echo %FILE_N% Extracting content from "%CONTENT_FILE%", this can take a while...
if exist "%ProgramW6432%/7-Zip/7z.exe" (
"%ProgramW6432%/7-Zip/7z.exe" x "%CONTENT_FILE%" -o"%CONTENT_FOLDER%" -y
if %errorlevel% neq 0 goto error_download
echo Deleting %CONTENT_FILE:/=\%
del %CONTENT_FILE:/=\%
"%ProgramW6432%/7-Zip/7z.exe" x "%CONTENT_FILE_TAR%" -o"%CONTENT_FOLDER%" -y
if %errorlevel% neq 0 goto error_download
echo Deleting %CONTENT_FILE_TAR:/=\%
del %CONTENT_FILE_TAR:/=\%
) else (
powershell -Command "Expand-Archive '%CONTENT_FILE%' -DestinationPath '%CONTENT_FOLDER%'"
if %errorlevel% neq 0 goto error_download
del %CONTENT_FILE%
)
goto success
:success
echo.
echo %FILE_N% Content has been successfully installed in "%CONTENT_FOLDER%"!
goto good_exit
:error_download
goto bad_exit
:good_exit
echo %FILE_N% Exiting...
endlocal
exit /b 0
:bad_exit
if exist "%CONTENT_FILE%" rd /s /q "%CONTENT_FOLDER%"
echo %FILE_N% Exiting with error...
endlocal
exit /b %errorlevel%
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。