anchor.diff:  @echo off
   
  -rem First make sure we rebuild the message codecs & printers
  -rem Some of the .c and .h files are automatically generated by python.
  +REM First make sure we rebuild the message codecs & printers
  +REM Some of the .c and .h files are automatically generated by python.
   cd common
   python messageCodeGenerator.py setupMessages.py
  -echo %ERRORLEVEL%
  +if %ERRORLEVEL% neq 0 (
  +    echo ** Build Failed while running python script. 
  +    echo ** Make sure the folder containing python.exe is added to PATH.
  +    cd ..
  +    goto EOF
  +)
   cd ..
   
  -rem Check if the VCINSTALLDIR variable has been set.
  -rem If it has not been set... try to find the right version of Visual Studio to use.
  +REM Check if the VCINSTALLDIR variable has been set.
  +REM If it has not been set... try to find the right version of Visual Studio to use.
  +set VS_BATCH_FILE=vsvars32.bat
  +
   if "%VCINSTALLDIR%"=="" (
  -echo User has not run vcvars32.bat, run automatically if available
  -if not "%VS80COMNTOOLS%"=="" (
  -call "%VS80COMNTOOLS%\vsvars32.bat"
  +echo User has not run %VS_BATCH_FILE%, run automatically if available
  +if not "%VS100COMNTOOLS%"=="" (
  +call "%VS100COMNTOOLS%\%VS_BATCH_FILE%"
   ) else if not "%VS90COMNTOOLS%"=="" (
  -call "%VS90COMNTOOLS%\vsvars32.bat"
  -) else if not "%VS100COMNTOOLS"=="" (
  -call "%VS100COMNTOOLS%\vsvars32.bat"
  +call "%VS90COMNTOOLS%\%VS_BATCH_FILE%"
  +) else if not "%VS80COMNTOOLS%"=="" (
  +call "%VS80COMNTOOLS%\%VS_BATCH_FILE%"
   ) else (
   echo Unable to find appropriate Visual Studio version based on VSxxxCOMNTOOLS variable.  
  -echo Try running vcvars32.bat
  +echo Try running %VS_BATCH_FILE%
   exit /b 1
   )
   )
   
  -rem Determine the Visual Studio version based on VCINSTALLDIR variable
  -for /F "usebackq delims=\ tokens=3  " %%i in (`set VCINSTALLDIR`) do set VS_VERSION_STR=%%i
  -if "%VS_VERSION_STR%"=="Microsoft Visual Studio 8" (
  +REM Determine the Visual Studio version based on VCINSTALLDIR variable
  +for /F "usebackq delims=\ tokens=3" %%i in (`set VCINSTALLDIR`) do set VS_VERSION_STR=%%i
  +if "%VS_VERSION_STR%"=="Microsoft Visual Studio 10.0" (
  +set VS_VERSION=vs2010
  +) else if "%VS_VERSION_STR%"=="Microsoft Visual Studio 9.0" (
  +set VS_VERSION=vs2008
  +) else if "%VS_VERSION_STR%"=="Microsoft Visual Studio 8" (
   set VS_VERSION=vs2005
  -) else if "%VS_VERSION_STR%"=="Microsoft Visual Studio 9" (
  -set VS_VERSION=vs2008
  -) else if "%VS_VERSION_STR%"=="Microsoft Visual Studio 10.0" (
  -set VS_VERSION=vs2010
   ) else (
   echo Unable to determine Visual Studio version based on VCINSTALLDIR variable.  
  -echo Try running vcvars32.bat
  +echo Try running %VS_BATCH_FILE%
   exit /b 1
   )
   echo Using Visual Studio Version: %VS_VERSION%
  
positive.code: mkdir %WORKDIR%\lib
  mkdir %WORKDIR%\include
  mkdir %WORKDIR%\include\freespace
  rem Build, but don't distribute debug versions. This avoids people doing
  rem reasonable things that won't work like not installing the DDK or 
  rem debugging under different compilers. 
  rem mkdir %WORKDIR%\lib\Debug
  mkdir %WORKDIR%\lib\Release
  echo Copying DLLs and LIBs
  rem copy win32\%VS_VERSION%\Debug\libfreespaced.lib %WORKDIR%\lib\Debug
  rem copy win32\%VS_VERSION%\Debug\libfreespaced.dll %WORKDIR%\lib\Debug
  copy win32\%VS_VERSION%\Release\libfreespace.lib %WORKDIR%\lib\Release
  copy win32\%VS_VERSION%\Release\libfreespace.dll %WORKDIR%\lib\Release
  echo Copying header files
  
negative.code: 
  REM Create ZIP file using Info-ZIP
  REM http://www.info-zip.org/Zip.html
  REM echo Zipping - be sure to have zip.exe in your path or you will get an error below
  REM zip -r %ZIPNAME%.zip %WORKDIR%
  
  echo Zipping using 7-zip (http://www.7-zip.org/)
  7z u -r %ZIPNAME%.zip %WORKDIR%
  if %ERRORLEVEL% neq 0 (
      echo ** Unable to build the archive. 
      echo ** Make sure folder containing 7z.exe is added to PATH.
  )
  
  echo Cleaning up work directory
  rd /S /Q %WORKDIR%
  echo Done.
  
  REM add this to the end of the file
  :EOF
  
  
  