mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-01 01:42:17 +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:
		
							
								
								
									
										11
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -10,6 +10,13 @@ if "%~1" == "/h" ( | |||||||
|     call :%* |     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 | exit /b | ||||||
|  |  | ||||||
| :enhance_path | :enhance_path | ||||||
| @@ -50,7 +57,7 @@ exit /b | |||||||
|         set "position=" |         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" ( |     if "%ERRORLEVEL%" == "0" ( | ||||||
|         set "add_to_path=%add_path%" |         set "add_to_path=%add_path%" | ||||||
| @@ -184,7 +191,7 @@ exit /b | |||||||
|         set "position=" |         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" ( |     if "%ERRORLEVEL%" == "0" ( | ||||||
|         set "add_to_path=%add_path%" |         set "add_to_path=%add_path%" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user