Skip to content

Commit 7ceacb6

Browse files
committed
respect PATHEXT instead of hardcoding our own value
* support other path extensions as well (e.g. `.py` commonly used)
1 parent 5101788 commit 7ceacb6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

vendor/lib/lib_path.cmd

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ if "%~1" == "/h" (
1010
call :%*
1111
)
1212

13+
setlocal enabledelayedexpansion
14+
if not defined find_pathext (
15+
set "find_pathext=!PATHEXT:;= !"
16+
set "find_pathext=!find_pathext:.=\.!"
17+
)
18+
endlocal & set "find_pathext=%find_pathext%"
19+
1320
exit /b
1421

1522
:enhance_path
@@ -50,7 +57,7 @@ exit /b
5057
set "position="
5158
)
5259

53-
dir "%add_path%" 2>NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
60+
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
5461

5562
if "%ERRORLEVEL%" == "0" (
5663
set "add_to_path=%add_path%"
@@ -184,7 +191,7 @@ exit /b
184191
set "position="
185192
)
186193

187-
dir "%add_path%" 2>NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
194+
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
188195

189196
if "%ERRORLEVEL%" == "0" (
190197
set "add_to_path=%add_path%"

0 commit comments

Comments
 (0)