Skip to content

Commit d15e7ac

Browse files
committed
cleanup
2 parents 9b466e3 + 1263470 commit d15e7ac

File tree

3 files changed

+39
-26
lines changed

3 files changed

+39
-26
lines changed

vendor/bin/excd.cmd

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
@if "%~1"=="/?" (@cd %*)
2-
@set excd=%*
3-
@set excd=%excd:"=%
4-
@if "%excd:~0,1%"=="~" (@set excd=%userprofile%\%excd:~1%)
5-
@if not "%~1"=="/d" (@set excd_param="/d") else (@set excd_param=)
6-
@cd %excd_param% "%excd%"
1+
@echo off
2+
set excd=%*
3+
set excd=%excd:"=%
4+
set excd_param=/d
5+
if /i "%excd:~0,2%"=="/d" set "excd=%excd:~2%"
6+
if "%excd:~0,1%"=="~" (set excd=%userprofile%\%excd:~1%)
7+
if "%excd:~0,1%"=="/" (set excd_param=)
8+
cd %excd_param% %excd%

vendor/init.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ if "%CMDER_ALIASES%" == "1" (
478478
)
479479

480480
:: Add aliases to the environment
481-
type "%user_aliases%" | findstr /b /l /i "history=cat " >nul
481+
type "%user_aliases%" | %WINDIR%\System32\findstr /b /l /i "history=cat " >nul
482482
if "%ERRORLEVEL%" == "0" (
483483
echo Migrating alias 'history' to new Clink 1.x.x...
484484
call "%CMDER_ROOT%\vendor\bin\alias.cmd" /d history

vendor/lib/lib_path.cmd

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@echo off
22

3-
43
call "%~dp0lib_base.cmd"
54
call "%%~dp0lib_console"
65
set lib_path=call "%~dp0lib_path.cmd"
@@ -11,6 +10,13 @@ if "%~1" == "/h" (
1110
call :%*
1211
)
1312

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+
1420
exit /b
1521

1622
:enhance_path
@@ -32,13 +38,12 @@ exit /b
3238
:::options:
3339
:::
3440
::: append <in> Append to the path env variable rather than pre-pend.
35-
::B
41+
:::
3642
:::
3743
:::output:
3844
:::
3945
::: path <out> Sets the path env variable if required.
4046
:::-------------------------------------------------------------------------------
41-
4247
if "%~1" neq "" (
4348
set "add_path=%~1"
4449
) else (
@@ -52,7 +57,8 @@ exit /b
5257
set "position="
5358
)
5459

55-
dir "%add_path%" | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
60+
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
61+
5662
if "%ERRORLEVEL%" == "0" (
5763
set "add_to_path=%add_path%"
5864
) else (
@@ -81,20 +87,20 @@ exit /b
8187
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;"
8288
call :set_found
8389
)
84-
%print_debug% :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!"
90+
%print_debug% :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!"
8591

8692
if /i "!position!" == "append" (
8793
if "!found!" == "0" (
8894
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$"
8995
call :set_found
9096
)
91-
%print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!"
97+
%print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!"
9298
) else (
9399
if "!found!" == "0" (
94100
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;"
95101
call :set_found
96102
)
97-
%print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
103+
%print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
98104
)
99105
endlocal & set found=%found%
100106

@@ -129,13 +135,12 @@ exit /b
129135
exit /b
130136

131137
:changed
132-
%print_debug% :enhance_path "END Env Var - PATH=%path%"
133-
%print_debug% :enhance_path "Env Var %find_query% - found=%found%"
138+
%print_debug% :enhance_path "END Env Var - PATH=%path%"
139+
%print_debug% :enhance_path "Env Var %find_query% - found=%found%"
134140
exit /b
135141

136142
exit /b
137143

138-
139144
:set_found
140145
if "%ERRORLEVEL%" == "0" (
141146
set found=1
@@ -190,7 +195,7 @@ exit /b
190195
set "position="
191196
)
192197

193-
dir "%add_path%" 2>NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
198+
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
194199

195200
if "%ERRORLEVEL%" == "0" (
196201
set "add_to_path=%add_path%"
@@ -204,7 +209,7 @@ exit /b
204209
set "path=%path%;%add_to_path%"
205210
) else (
206211
set "path=%add_to_path%;%path%"
207-
)
212+
)
208213
)
209214
)
210215

@@ -213,10 +218,10 @@ exit /b
213218
exit /b
214219
)
215220

216-
%print_debug% :set_path_recursive "Env Var - add_path=%add_to_path%"
217-
%print_debug% :set_path_recursive "Env Var - position=%position%"
218-
%print_debug% :set_path_recursive "Env Var - depth=%depth%"
219-
%print_debug% :set_path_recursive "Env Var - max_depth=%max_depth%"
221+
%print_debug% :set_path_recursive "Env Var - add_path=%add_to_path%"
222+
%print_debug% :set_path_recursive "Env Var - position=%position%"
223+
%print_debug% :set_path_recursive "Env Var - depth=%depth%"
224+
%print_debug% :set_path_recursive "Env Var - max_depth=%max_depth%"
220225

221226
if %max_depth% gtr %depth% (
222227
if "%add_to_path%" neq "" (
@@ -225,7 +230,7 @@ exit /b
225230
set "path=%path%;%add_to_path%"
226231
) else (
227232
set "path=%add_to_path%;%path%"
228-
)
233+
)
229234
)
230235
call :set_depth
231236
call :loop_depth
@@ -235,7 +240,7 @@ exit /b
235240

236241
exit /b
237242

238-
: set_depth
243+
:set_depth
239244
set /a "depth=%depth%+1"
240245
exit /b
241246

@@ -245,10 +250,16 @@ exit /b
245250
)
246251

247252
for /d %%i in ("%add_path%\*") do (
253+
<<<<<<< HEAD
248254
%print_debug% :set_path_recursive "Env Var BEFORE - depth=%depth%"
249255
%print_debug% :set_path_recursive "Found Subdirectory - '%%~fi'"
250256
call :set_path_recursive "%%~fi" %depth% %max_depth% %position%
251257
%print_debug% :set_path_recursive "Env Var AFTER- depth=%depth%"
258+
=======
259+
%print_debug% :enhance_path_recursive "Env Var BEFORE - depth=%depth%"
260+
%print_debug% :enhance_path_recursive "Found Subdirectory - '%%~fi'"
261+
call :enhance_path_recursive "%%~fi" %depth% %max_depth% %position%
262+
%print_debug% :enhance_path_recursive "Env Var AFTER- depth=%depth%"
263+
>>>>>>> 126347025f9cade241beff182738b2527da7535e
252264
)
253265
exit /b
254-

0 commit comments

Comments
 (0)