# HG changeset patch
# User Matt Harbison <
matt_h...@yahoo.com>
# Date 1745603944 14400
# Fri Apr 25 13:59:04 2025 -0400
# Branch stable
# Node ID 7041279d545583ec40e3e5b5cfb8ad6ab7429d74
# Parent 2e46a40ecc9cc87d4eff64538de345caa0f9772f
build: quote environment variables that may have spaces on Windows
Builds have been complaining for several years now that 'Files' is not
recognized as an internal or external command, and it's because `%hhc_compiler%`
was set to its path in `%ProgramFiles(x86)%` (which has spaces), and skewed the
meaning of the `if not exist` conditional. That caused the variable to be set
to `hhc.exe` unconditionally, which still worked because it also happened to be
on PATH.
The trailing '.' was a way to keep the syntax valid if the variable evaluated
to an empty string. But, we're better off without it, now that there's quoting:
C:\>if not exist "C:\Program Files (x86)\HTML Help Workshop\hhc.exe". ( echo missing )
C:\>if not exist "". ( echo missing )
C:\>if not exist "" ( echo missing )
missing
diff --git a/doc/Build.bat b/doc/Build.bat
--- a/doc/Build.bat
+++ b/doc/Build.bat
@@ -1,10 +1,10 @@
@echo off
setlocal
-if not exist %hhc_compiler%. (
+if not exist "%hhc_compiler%" (
set hhc_compiler=hhc.exe
)
-if not exist %qcollectiongenerator%. (
+if not exist "%qcollectiongenerator%" (
set qcollectiongenerator=qcollectiongenerator.exe
)
set PDFLATEX=PdfLatex
@@ -65,7 +65,7 @@
if "%1" == "chm" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %OUTPUTDIR%/chm
- %hhc_compiler% %OUTPUTDIR%/chm/TortoiseHg.hhp
+ "%hhc_compiler%" %OUTPUTDIR%/chm/TortoiseHg.hhp
echo.
echo.Build finished. The CHM file is in %OUTPUTDIR%/chm.
goto end
@@ -84,7 +84,7 @@
if "%1" == "qhc" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %OUTPUTDIR%/qthelp
- %qcollectiongenerator% %OUTPUTDIR%/qthelp/TortoiseHg.qhcp
+ "%qcollectiongenerator%" %OUTPUTDIR%/qthelp/TortoiseHg.qhcp
echo.
echo.Build finished. The QHC file is in %OUTPUTDIR%/qthelp.
goto end