diff --git a/compile.bat b/compile.bat index 3ef0b723fc8e988968672ceb9ab617adc7e26087..ec88b9f2de52a9c91a88990a159ec51093186239 100644 --- a/compile.bat +++ b/compile.bat @@ -1,6 +1,26 @@ -@echo off +::@echo off :: Free Cities Basic Compiler - Windows +:: See if we can find a git installation +setlocal enabledelayedexpansion + +for %%k in (HKCU HKLM) do ( + for %%w in (\ \Wow6432Node\) do ( + for /f "skip=2 delims=: tokens=1*" %%a in ('reg query "%%k\SOFTWARE%%wMicrosoft\Windows\CurrentVersion\Uninstall\Git_is1" /v InstallLocation 2^> nul') do ( + for /f "tokens=3" %%z in ("%%a") do ( + set GIT=%%z:%%b + set GITFOUND=yes + goto FOUND + ) + ) + ) +) +:FOUND +if %GITFOUND% == yes ( + set "PATH=%GIT%bin;%PATH%" + bash --login -c ./sanityCheck +) + :: Will add all *.tw files to StoryIncludes. del src\config\start.tw copy src\config\start.tw.proto start.tw.tmp >nul @@ -14,5 +34,13 @@ if %PROCESSOR_ARCHITECTURE% == AMD64 ( CALL "%~dp0devTools\tweeGo\tweego_win86.exe" -o "%~dp0bin/FC_pregmod.html" "%~dp0src\config\start.tw" ) +if %GITFOUND% == yes ( + :: Make the output prettier, replacing \t with a tab and \n with a newline + bash -c "sed -i -e '/^.*<div id=\"store-area\".*$/s/\\\t/\t/g' -e '/^.*<div id=\"store-area\".*$/s/\\\n/\n/g' bin/FC_pregmod.html" + + :: Revert ./src/init/storyInit.tw for next compilation + git checkout -- ./src/init/storyInit.tw +) + del src\config\start.tw ECHO Done