Skip to content

Commit b21c70d

Browse files
committed
install script now detects an existing VS environment.
1 parent 124d44f commit b21c70d

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

install_script.bat

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ REM Defined cript variables
44
set NASMDL=http://www.nasm.us/pub/nasm/releasebuilds
55
set NASMVERSION=2.12.02
66

7+
REM Store current directory and ensure working directory is the location of current .bat
8+
SET CALLDIR=%CD%
9+
cd %~dp0
10+
11+
REM Initialise error check value
12+
SET ERROR=0
13+
714
REM Check what architecture we are installing on
815
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
916
echo Detected 64 bit system...
@@ -21,6 +28,25 @@ if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
2128
goto Terminate
2229
)
2330

31+
REM Check if already running in an environment with VS setup
32+
if defined VCINSTALLDIR (
33+
if defined VisualStudioVersion (
34+
echo Existing Visual Studio environment detected...
35+
if "%VisualStudioVersion%"=="15.0" (
36+
set MSVC_VER=15
37+
goto MSVCVarsDone
38+
) else if "%VisualStudioVersion%"=="14.0" (
39+
set MSVC_VER=14
40+
goto MSVCVarsDone
41+
) else if "%VisualStudioVersion%"=="12.0" (
42+
set MSVC_VER=12
43+
goto MSVCVarsDone
44+
) else (
45+
echo Unknown Visual Studio environment detected '%VisualStudioVersion%', Creating a new one...
46+
)
47+
)
48+
)
49+
2450
REM First check for a environment variable to help locate the VS installation
2551
if defined VS140COMNTOOLS (
2652
if exist "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" (
@@ -161,6 +187,14 @@ if not exist "%VCINSTALLDIR%\nasm.exe" (
161187
)
162188
rd /S /Q "./TempNASMUnpack"
163189
echo Finished Successfully
190+
goto Exit
164191

165192
:Terminate
166-
pause
193+
SET ERROR=1
194+
195+
:Exit
196+
cd %CALLDIR%
197+
IF "%APPVEYOR%"=="" (
198+
pause
199+
)
200+
exit /b %ERROR%

0 commit comments

Comments
 (0)