Skip to content

Commit

Permalink
Uses absolute path for destination
Browse files Browse the repository at this point in the history
  • Loading branch information
reksar committed Sep 20, 2023
1 parent c928cef commit f61a0ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions get-sdk.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ call which check-components >NUL 2>&1 || set "PATH=%~dp0sdk;%PATH%"

set url=%~1
call destination "%~2" || exit /b 1

call check-components "%destination%" && (
echo [WARN][%~n0] SDK already exist!
exit /b 0
)

echo Getting Windows SDK

for %%i in ("%destination%") do set "tmp=%%~fi\tmp"
set "tmp=%destination%\tmp"

set "archiver=%tmp%\7-zip"
call ensure-archiver "%archiver%"
Expand All @@ -39,8 +41,7 @@ call get-iso "%url%" "%iso%" || exit /b 2
call extract-installers "%iso%" "%installers%" || exit /b 3

:COMPONENTS
set "lessmsi=%tmp%\lessmsi"
call ensure-lessmsi "%lessmsi%" || exit /b 4
call ensure-lessmsi "%tmp%\lessmsi" || exit /b 4
set "components=%tmp%\components"
call extract-components "%installers%" "%components%" || exit /b 5
call collect-components "%components%" "%destination%" || exit /b 6
Expand Down
11 changes: 8 additions & 3 deletions utils/destination.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@echo off

rem --------------------------------------------------------------------------
rem Sets the %destination% var without trailing backslash and creates the
rem associated dir if needed.
rem Ensures the %destination% is set to an absolute path without trailing
rem backslashes and creates the corresponding dir if necessary.
rem --------------------------------------------------------------------------

set destination=%~1
Expand All @@ -23,6 +23,11 @@ if "%destination%" == "" (
exit /b 2
)

if not exist "%destination%" md "%destination%"
for %%i in ("%destination%") do set "destination=%%~fi"

if not exist "%destination%" md "%destination%" || (
echo [ERR][%~n0] Unable to create "%destination%"!
exit /b 3
)

exit /b 0

0 comments on commit f61a0ec

Please sign in to comment.