Skip to content

Commit c594855

Browse files
committed
Update install script so that it runs correctly from a different directory.
1 parent b41d87b commit c594855

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

install_script.bat

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ set YASMDL=http://www.tortall.net/projects/yasm/releases
55
set YASMVERSION=1.3.0
66

77
REM Store current directory and ensure working directory is the location of current .bat
8-
SET CALLDIR=%CD%
9-
cd %~dp0
8+
set CALLDIR=%CD%
9+
set SCRIPTDIR=%~dp0
1010

1111
REM Initialise error check value
1212
SET ERROR=0
@@ -145,35 +145,35 @@ if not "%CURRDIR%"=="%CD%" (
145145

146146
REM copy the BuildCustomizations to VCTargets folder
147147
echo Installing build customisations...
148-
copy /B /Y /V "./yasm.*" "%VCTargetsPath%\BuildCustomizations\" 1>NUL 2>NUL
148+
copy /B /Y /V "%SCRIPTDIR%\yasm.*" "%VCTargetsPath%\BuildCustomizations\" 1>NUL 2>NUL
149149
if not exist "%VCTargetsPath%\BuildCustomizations\yasm.props" (
150150
echo Error: Failed to copy build customisations!
151151
echo Ensure that this script is run in a shell with the necessary write privileges
152152
goto Terminate
153153
)
154154

155155
REM Check if a yasm binary was bundled
156-
if not exist "%~dp0/yasm" (
156+
if not exist "%SCRIPTDIR%\yasm\" (
157157
REM Download the latest yasm binary for windows goto Terminate
158158
call :DownloadYasm
159159
) else (
160160
REM Use the bundled binaries
161161
if "%SYSARCH%"=="x32" (
162-
copy /B /Y /V ".\yasm\yasm-32.exe" ".\yasm.exe" 1>NUL 2>NUL
162+
copy /B /Y /V "%SCRIPTDIR%\yasm\yasm-32.exe" "%SCRIPTDIR%\yasm.exe" 1>NUL 2>NUL
163163
) else if "%SYSARCH%"=="x64" (
164-
copy /B /Y /V ".\yasm\yasm-64.exe" ".\yasm.exe" 1>NUL 2>NUL
164+
copy /B /Y /V "%SCRIPTDIR%\yasm\yasm-64.exe" "%SCRIPTDIR%\yasm.exe" 1>NUL 2>NUL
165165
) else (
166166
goto Terminate
167167
)
168168
)
169169

170170
REM copy yasm executable to VC installation folder
171171
echo Installing required YASM release binary...
172-
move /Y "yasm.exe" "%VCINSTALLDIR%\" 1>NUL 2>NUL
172+
move /Y "%SCRIPTDIR%\yasm.exe" "%VCINSTALLDIR%\" 1>NUL 2>NUL
173173
if not exist "%VCINSTALLDIR%\yasm.exe" (
174174
echo Error: Failed to install YASM binary!
175175
echo Ensure that this script is run in a shell with the necessary write privileges
176-
del /F /Q "./yasm.exe" 1>NUL 2>NUL
176+
del /F /Q "%SCRIPTDIR%\yasm.exe" 1>NUL 2>NUL
177177
goto Terminate
178178
)
179179
echo Finished Successfully
@@ -198,8 +198,8 @@ if "%SYSARCH%"=="x32" (
198198
goto Terminate
199199
)
200200
echo Downloading required YASM release binary...
201-
powershell.exe -Command (New-Object Net.WebClient).DownloadFile('%YASMDOWNLOAD%', './yasm.exe') 1>NUL 2>NUL
202-
if not exist "./yasm.exe" (
201+
powershell.exe -Command (New-Object Net.WebClient).DownloadFile('%YASMDOWNLOAD%', '%SCRIPTDIR%\yasm.exe') 1>NUL 2>NUL
202+
if not exist "%SCRIPTDIR%\yasm.exe" (
203203
echo Error: Failed to download required YASM binary!
204204
echo The following link could not be resolved "%YASMDOWNLOAD%"
205205
goto Terminate

0 commit comments

Comments
 (0)