mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 17:59:11 +08:00
optimize for speed
This commit is contained in:
parent
b3af7c3983
commit
274cce1f00
42
vendor/init.bat
vendored
42
vendor/init.bat
vendored
@ -306,7 +306,9 @@ goto :CONFIGURE_GIT
|
|||||||
:CONFIGURE_GIT
|
:CONFIGURE_GIT
|
||||||
%print_debug% init.bat "Using Git from '%GIT_INSTALL_ROOT%..."
|
%print_debug% init.bat "Using Git from '%GIT_INSTALL_ROOT%..."
|
||||||
:: Add git to the path
|
:: Add git to the path
|
||||||
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" ""
|
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" (
|
||||||
|
set "path=%GIT_INSTALL_ROOT%\cmd;%path%"
|
||||||
|
)
|
||||||
|
|
||||||
:: Add the unix commands at the end to not shadow windows commands like `more` and `find`
|
:: Add the unix commands at the end to not shadow windows commands like `more` and `find`
|
||||||
if %nix_tools% equ 1 (
|
if %nix_tools% equ 1 (
|
||||||
@ -319,12 +321,24 @@ if %nix_tools% equ 1 (
|
|||||||
|
|
||||||
if %nix_tools% geq 1 (
|
if %nix_tools% geq 1 (
|
||||||
if exist "%GIT_INSTALL_ROOT%\mingw32" (
|
if exist "%GIT_INSTALL_ROOT%\mingw32" (
|
||||||
%lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position%
|
if "%path_position%" == "append" (
|
||||||
|
set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin"
|
||||||
|
) else (
|
||||||
|
set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%"
|
||||||
|
)
|
||||||
) else if exist "%GIT_INSTALL_ROOT%\mingw64" (
|
) else if exist "%GIT_INSTALL_ROOT%\mingw64" (
|
||||||
%lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw64\bin" %path_position%
|
if "%path_position%" == "append" (
|
||||||
|
set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin"
|
||||||
|
) else (
|
||||||
|
set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
if exist "%GIT_INSTALL_ROOT%\usr\bin" (
|
if exist "%GIT_INSTALL_ROOT%\usr\bin" (
|
||||||
%lib_path% enhance_path "%GIT_INSTALL_ROOT%\usr\bin" %path_position%
|
if "%path_position%" == "append" (
|
||||||
|
set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin"
|
||||||
|
) else (
|
||||||
|
set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -368,14 +382,23 @@ goto :PATH_ENHANCE
|
|||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
:PATH_ENHANCE
|
:PATH_ENHANCE
|
||||||
%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin"
|
set "path=%CMDER_ROOT%\vendor\bin;%path%"
|
||||||
|
|
||||||
:USER_CONFIG_START
|
:USER_CONFIG_START
|
||||||
%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth%
|
if %max_depth% gtr 1 (
|
||||||
if defined CMDER_USER_BIN (
|
%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth%
|
||||||
%lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth%
|
) else (
|
||||||
|
set "path=%CMDER_ROOT%\bin;%path%"
|
||||||
)
|
)
|
||||||
%lib_path% enhance_path "%CMDER_ROOT%" append
|
|
||||||
|
if defined CMDER_USER_BIN (
|
||||||
|
if %max_depth% gtr 1 (
|
||||||
|
%lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth%
|
||||||
|
) else (
|
||||||
|
set "path=%CMDER_USER_ROOT%\bin;%path%"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
set "path=%path%;%CMDER_ROOT%"
|
||||||
|
|
||||||
:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d"
|
:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d"
|
||||||
:: to run them at startup.
|
:: to run them at startup.
|
||||||
@ -489,7 +512,6 @@ if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1
|
|||||||
|
|
||||||
set CMDER_INIT_END=%time%
|
set CMDER_INIT_END=%time%
|
||||||
|
|
||||||
if %time_init% gtr 0 (
|
|
||||||
"%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%"
|
"%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%"
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
38
vendor/lib/lib_path.cmd
vendored
38
vendor/lib/lib_path.cmd
vendored
@ -144,8 +144,12 @@ exit /b
|
|||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:enhance_path_recursive
|
:enhance_path_recursive
|
||||||
|
call :set_path_recursive "%~1" "%~2" "%~3"
|
||||||
|
exit /b
|
||||||
|
|
||||||
|
:set_path_recursive
|
||||||
:::===============================================================================
|
:::===============================================================================
|
||||||
:::enhance_path_recursive - Add a directory and subs to the path env variable if
|
:::set_path_recursive - Add a directory and subs to the path env variable if
|
||||||
::: required.
|
::: required.
|
||||||
:::.
|
:::.
|
||||||
:::include:
|
:::include:
|
||||||
@ -154,7 +158,7 @@ exit /b
|
|||||||
:::.
|
:::.
|
||||||
:::usage:
|
:::usage:
|
||||||
:::.
|
:::.
|
||||||
::: call "%~DP0lib_path" enhance_path_recursive "[dir_path]" [max_depth] [append]
|
::: call "%~DP0lib_path" set_path_recursive "[dir_path]" [max_depth] [append]
|
||||||
:::.
|
:::.
|
||||||
:::required:
|
:::required:
|
||||||
:::.
|
:::.
|
||||||
@ -196,7 +200,11 @@ exit /b
|
|||||||
|
|
||||||
if "%fast_init%" == "1" (
|
if "%fast_init%" == "1" (
|
||||||
if "%add_to_path%" neq "" (
|
if "%add_to_path%" neq "" (
|
||||||
call :enhance_path "%add_to_path%" %position%
|
if "%position%" == "append" (
|
||||||
|
set "path=%path%;%add_to_path%"
|
||||||
|
) else (
|
||||||
|
set "path=%add_to_path%;%path%"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -205,15 +213,19 @@ exit /b
|
|||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
%print_debug% :enhance_path_recursive "Env Var - add_path=%add_to_path%"
|
%print_debug% :set_path_recursive "Env Var - add_path=%add_to_path%"
|
||||||
%print_debug% :enhance_path_recursive "Env Var - position=%position%"
|
%print_debug% :set_path_recursive "Env Var - position=%position%"
|
||||||
%print_debug% :enhance_path_recursive "Env Var - depth=%depth%"
|
%print_debug% :set_path_recursive "Env Var - depth=%depth%"
|
||||||
%print_debug% :enhance_path_recursive "Env Var - max_depth=%max_depth%"
|
%print_debug% :set_path_recursive "Env Var - max_depth=%max_depth%"
|
||||||
|
|
||||||
if %max_depth% gtr %depth% (
|
if %max_depth% gtr %depth% (
|
||||||
if "%add_to_path%" neq "" (
|
if "%add_to_path%" neq "" (
|
||||||
%print_debug% :enhance_path_recursive "Adding parent directory - '%add_to_path%'"
|
%print_debug% :set_path_recursive "Adding parent directory - '%add_to_path%'"
|
||||||
call :enhance_path "%add_to_path%" %position%
|
if "%position%" == "append" (
|
||||||
|
set "path=%path%;%add_to_path%"
|
||||||
|
) else (
|
||||||
|
set "path=%add_to_path%;%path%"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
call :set_depth
|
call :set_depth
|
||||||
call :loop_depth
|
call :loop_depth
|
||||||
@ -233,10 +245,10 @@ exit /b
|
|||||||
)
|
)
|
||||||
|
|
||||||
for /d %%i in ("%add_path%\*") do (
|
for /d %%i in ("%add_path%\*") do (
|
||||||
%print_debug% :enhance_path_recursive "Env Var BEFORE - depth=%depth%"
|
%print_debug% :set_path_recursive "Env Var BEFORE - depth=%depth%"
|
||||||
%print_debug% :enhance_path_recursive "Found Subdirectory - '%%~fi'"
|
%print_debug% :set_path_recursive "Found Subdirectory - '%%~fi'"
|
||||||
call :enhance_path_recursive "%%~fi" %depth% %max_depth% %position%
|
call :set_path_recursive "%%~fi" %depth% %max_depth% %position%
|
||||||
%print_debug% :enhance_path_recursive "Env Var AFTER- depth=%depth%"
|
%print_debug% :set_path_recursive "Env Var AFTER- depth=%depth%"
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user