gbe_fork/generate_credits.bat

28 lines
1.1 KiB
Batchfile
Raw Normal View History

2024-08-18 20:23:53 +08:00
@echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
2024-08-25 17:36:17 +08:00
set "ROOT=%cd%"
set "CREDITS_FILE=%ROOT%\CREDITS.md"
2024-08-18 20:23:53 +08:00
if exist "%CREDITS_FILE%" (
del /f /q "%CREDITS_FILE%"
2024-08-18 20:23:53 +08:00
)
set "GLOB=third-party libs tools\steamclient_loader sdk"
2024-08-18 20:23:53 +08:00
set "FILTER=SOURCE.txt"
echo:# Many thanks for these sources>> "%CREDITS_FILE%"
for %%A in (%GLOB%) do (
powershell -Command "Get-ChildItem -LiteralPath \"%%~A\" -Filter \"%FILTER%\" -File -Recurse | foreach { $parent = Split-Path -Path $_.FullName -Parent; $relative = (Resolve-Path -Path $parent -Relative).replace(\".\\\",\"\"); $relative_tag = $relative.replace(\"\\\", \"\"); Write-Output \"- ^[$^($relative^)^]^(#$^($relative_tag^)^)\"; }">> "%CREDITS_FILE%"
2024-08-18 20:23:53 +08:00
)
echo.>> "%CREDITS_FILE%"
for %%B in (%GLOB%) do (
powershell -Command "Get-ChildItem -LiteralPath \"%%~B\" -Filter \"%FILTER%\" -File -Recurse | foreach { $parent = Split-Path -Path $_.FullName -Parent; $relative = (Resolve-Path -Path $parent -Relative).replace(\".\\\",\"\"); Write-Output \"### $^($relative^)\"; Write-Output \"\"; Get-Content -LiteralPath $_.FullName -Raw -Encoding utf8; }">> "%CREDITS_FILE%"
)
endlocal