From 828edda5fca36a8f645964bbfb928480034e790e Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Fri, 4 Sep 2020 17:17:06 -0700 Subject: [PATCH] Try to use powershell to strip path information before it pollutes the output file --- devTools/concatFiles.bat | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/devTools/concatFiles.bat b/devTools/concatFiles.bat index 3da9527a846..b2efe3feb26 100644 --- a/devTools/concatFiles.bat +++ b/devTools/concatFiles.bat @@ -4,11 +4,20 @@ :: TODO Proper temp file instead of bin\list.txt IF EXIST %3 DEL %3 SET _LISTFILE="bin\list.txt" + +:: Collect sorted list of files >%_LISTFILE% (FOR /R "%~1" %%F IN (%2) DO echo "%%F") sort /O %_LISTFILE% %_LISTFILE% + +:: If we have powershell available, strip the absolute path information +:: If not, fail silently (which is fine, but will leak path information into the built file) +powershell -command "" 2> NUL +IF %ERRORLEVEL% EQU 0 powershell -command "(get-content -path %_LISTFILE% -raw) -replace [regex]::escape('%CD%'),'' -replace '\"','' ^| set-content -path %_LISTFILE%" + +:: Append the files (FOR /F "usebackq delims=" %%F IN (`type "%_LISTFILE%"`) DO ( echo /* %%F */ >> %3 - copy /b %3+%%F %3 1>NUL + copy /b %3+"%CD%%%F" %3 1>NUL ) ) -- GitLab