Allow MSVC .bat wrappers to be called from anywhere
authorAndrew Dunstan <andrew@dunslane.net>
Fri, 7 Jan 2022 21:07:45 +0000 (16:07 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Fri, 7 Jan 2022 21:07:45 +0000 (16:07 -0500)
Instead of using a hardcoded or default path to the perl file the .bat
file is a wrapper for, we use a path that means the file is found in
the same directory as the .bat file.

Patch by Anton Voloshin, slightly tweaked by me.

Backpatch to all live branches

Discussion: https://postgr.es/m/2b7a674b-5fb0-d264-75ef-ecc7a31e54f8@postgrespro.ru

src/tools/msvc/build.bat
src/tools/msvc/install.bat
src/tools/msvc/pgbison.bat
src/tools/msvc/pgflex.bat
src/tools/msvc/vcregress.bat

index 4001ac1d0d10693976069897bde1761d9dc54ee8..171f7498e2f12a3a64472050bbf8650e53d705ab 100755 (executable)
@@ -3,4 +3,4 @@ REM src/tools/msvc/build.bat
 REM all the logic for this now belongs in build.pl. This file really
 REM only exists so you don't have to type "perl build.pl"
 REM Resist any temptation to add any logic here.
-@perl build.pl %*
+@perl %~dp0/build.pl %*
index d03277eff2b74ece03a46069db199863885d09ea..d02b80826b7721264db654cbc36c32c67d132a88 100644 (file)
@@ -3,4 +3,4 @@ REM src/tools/msvc/install.bat
 REM all the logic for this now belongs in install.pl. This file really
 REM only exists so you don't have to type "perl install.pl"
 REM Resist any temptation to add any logic here.
-@perl install.pl %*
+@perl %~dp0/install.pl %*
index d976750c9c7fb5a3d8a83e7b8836cd02a0219d87..dc8ac4a2cf2fbe55302f37f41ffd95ebefa1f25e 100755 (executable)
@@ -4,4 +4,4 @@ REM src/tools/msvc/pgbison.bat
 REM all the logic for this now belongs in pgbison.pl. This file really
 REM only exists so you don't have to type "perl src/tools/msvc/pgbison.pl"
 REM Resist any temptation to add any logic here.
-@perl src/tools/msvc/pgbison.pl %*
+@perl %~dp0/pgbison.pl %*
index 3c7afe9c31750a127a8a43ecb22bd82735cf4820..f20834ba9b1187a1d5ee8364522c832477c6ef88 100755 (executable)
@@ -4,4 +4,4 @@ REM src/tools/msvc/pgflex.bat
 REM all the logic for this now belongs in pgflex.pl. This file really
 REM only exists so you don't have to type "perl src/tools/msvc/pgflex.pl"
 REM Resist any temptation to add any logic here.
-@perl src/tools/msvc/pgflex.pl %*
+@perl %~dp0/pgflex.pl %*
index a981d3a6aa119a887bac7d3ec691de31e5c5e58b..7fba45c1e77c5e6bda22dd0396e1689e45ca0caf 100644 (file)
@@ -3,4 +3,4 @@ REM src/tools/msvc/vcregress.bat
 REM all the logic for this now belongs in vcregress.pl. This file really
 REM only exists so you don't have to type "perl vcregress.pl"
 REM Resist any temptation to add any logic here.
-@perl vcregress.pl %*
+@perl %~dp0/vcregress.pl %*