Skip to content

Commit

Permalink
Improvements in autobuild-script to better handle subst drive re-use #…
Browse files Browse the repository at this point in the history
  • Loading branch information
leecher1337 committed Dec 27, 2024
1 parent 02a8622 commit e506dd9
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions autobuild/autobuild-ccpu-chk.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,30 @@ rem -- Path is too long, bad, do subst
setlocal enableDelayedExpansion
if not [%WKDIR:~0,-30%]==[] SET NEEDSUBST=1
if not "%NEEDSUBST%"=="" (
set "drives=WDEFGHIJKLMNOPQRSTUVXYZABC"
for /f "delims=:" %%A in ('wmic logicaldisk get caption') do set "drives=!drives:%%A=!"
set "WORKDRV=!drives:~0,1!"
set WORKDRV=
for /f "tokens=1* delims=:" %%A in ('subst') do (
for /f "tokens=2 delims=>" %%C in ("%%B") do (
for /f "tokens=* delims= " %%D in ("%%C") do (
set "MappedPath=%%D"
if /i "!MappedPath!"=="%WKDIR%" (
set "WORKDRV=%%A"
)
)
)
)

if "!WORKDRV!"=="" (
echo No free drive letter found, aborting, sorry...
pause
exit /b
if "!WORKDRV!"=="" (
set "drives=WDEFGHIJKLMNOPQRSTUVXYZABC"
for /f "delims=:" %%A in ('wmic logicaldisk get caption') do set "drives=!drives:%%A=!"
set "WORKDRV=!drives:~0,1!"

if "!WORKDRV!"=="" (
echo No free drive letter found, aborting, sorry...
pause
exit /b
)
subst !WORKDRV!: %WKDIR%
)
subst !WORKDRV!: %WKDIR%
set BLDDIR=!WORKDRV!:
) else (
set BLDDIR=%WKDIR%
Expand Down Expand Up @@ -281,6 +295,7 @@ if not exist %PREREQ%\%1 (
if not exist %PREREQ%\%1 (
echo Prerequisite %1 not found in %PREREQ%, FAILED!
pause
if not "%WORKDRV%"=="" subst %WORKDRV%: /d
exit
)
exit /b
Expand All @@ -289,6 +304,7 @@ exit /b
if not exist %PREREQ%\%1 (
echo Prerequisite %1 not found in %PREREQ%, FAILED!
pause
if not "%WORKDRV%"=="" subst %WORKDRV%: /d
exit
)
copy /y %PREREQ%\%1 ntvdmpatch\minnt\work\
Expand All @@ -298,6 +314,7 @@ exit /B
if not exist %PREREQ%\%1 (
echo Prerequisite %1 not found in %PREREQ%, FAILED!
pause
if not "%WORKDRV%"=="" subst %WORKDRV%: /d
exit
)
7z x -y %PREREQ%\%1
Expand Down

0 comments on commit e506dd9

Please sign in to comment.