mirror of
https://github.com/cmderdev/cmder.git
synced 2025-01-10 08:19:08 +08:00
respect PATHEXT instead of hardcoding our own value
* support other path extensions as well (e.g. `.py` commonly used)
This commit is contained in:
parent
510178852d
commit
7ceacb63dd
11
vendor/lib/lib_path.cmd
vendored
11
vendor/lib/lib_path.cmd
vendored
@ -10,6 +10,13 @@ if "%~1" == "/h" (
|
||||
call :%*
|
||||
)
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
if not defined find_pathext (
|
||||
set "find_pathext=!PATHEXT:;= !"
|
||||
set "find_pathext=!find_pathext:.=\.!"
|
||||
)
|
||||
endlocal & set "find_pathext=%find_pathext%"
|
||||
|
||||
exit /b
|
||||
|
||||
:enhance_path
|
||||
@ -50,7 +57,7 @@ exit /b
|
||||
set "position="
|
||||
)
|
||||
|
||||
dir "%add_path%" 2>NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
|
||||
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
|
||||
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
set "add_to_path=%add_path%"
|
||||
@ -184,7 +191,7 @@ exit /b
|
||||
set "position="
|
||||
)
|
||||
|
||||
dir "%add_path%" 2>NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
|
||||
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
|
||||
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
set "add_to_path=%add_path%"
|
||||
|
Loading…
Reference in New Issue
Block a user