Skip to content

Commit

Permalink
configure.bat: Fix errors on Windows
Browse files Browse the repository at this point in the history
Since the last change to configure.bat we got two of these errors,
regardless of the arguments passed to configure:
    The system cannot find the drive specified.

This is due to the quirky semantics of the :: commenting style that's
used within an if block. Lines starting with :: might be interpreted as
starting with a drive letter.

Switch to rem for comments to avoid such behavior.

Note that we have to quote the comments, because
    rem https://www.example.com/?foo=bar
will split the command at the equal sign and complain about
'unexpected bar'.

Mind-boggling trivia:
    rem https://www.example.com/?something_without_equal
will display the help text for the REM built-in, because /? is somewhere
in the string.

Change-Id: I2ffcc6bd4312d24bdde2b7f1e336f827f503e491
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
jobor committed Mar 5, 2024
1 parent 4775876 commit 073185a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ set REDO_FILE_PATH=%TOPQTDIR%\config.redo.last
set REDO_TMP_FILE_PATH=%TOPQTDIR%\config.redo.in
set FRESH_REQUESTED_ARG=
if not defined redoing (
:: The '.' in 'echo.%*' ensures we don't print "echo is off" when no arguments are passed
:: https://devblogs.microsoft.com/oldnewthing/20170802-00/?p=96735
:: The space before the '>' makes sure that when we have a digit at the end of the args, we
:: don't accidentally concatenate it with the '>' resulting in '0>' or '2>' which redirects
:: into the file from a stream different than stdout, leading to broken or empty content.
rem "The '.' in 'echo.%*' ensures we don't print "echo is off" when no arguments are passed"
rem "https://devblogs.microsoft.com/oldnewthing/20170802-00/?p=96735"
rem "The space before the '>' makes sure that when we have a digit at the end of the args, we"
rem "don't accidentally concatenate it with the '>' resulting in '0>' or '2>' which redirects"
rem "into the file from a stream different than stdout, leading to broken or empty content."
echo.%* >"%OPT_TMP_FILE_PATH%"

cmake -DIN_FILE="%OPT_TMP_FILE_PATH%" -DOUT_FILE="%OPT_FILE_PATH%" -DIGNORE_ARGS=-top-level -P "%QTSRC%\cmake\QtWriteArgsFile.cmake"
Expand Down

0 comments on commit 073185a

Please sign in to comment.