mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 03:12:16 +08:00 
			
		
		
		
	add debugging of path adds
This commit is contained in:
		
							
								
								
									
										41
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										41
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							@@ -165,9 +165,22 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" (
 | 
				
			|||||||
    set CMDER_CLINK=0
 | 
					    set CMDER_CLINK=0
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if exist "%CMDER_ROOT%\config\user_init.cmd" if defined CMDER_USER_CONFIG (
 | 
				
			||||||
 | 
					  call "%CMDER_ROOT%\config\user_init.cmd"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if exist "%CMDER_USER_CONFIG%\config\user_init.cmd" (
 | 
				
			||||||
 | 
					    call "%CMDER_USER_CONFIG%\config\user_init.cmd"
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					  exit /b
 | 
				
			||||||
 | 
					) else if exist "%CMDER_ROOT%\config\user_init.cmd" (
 | 
				
			||||||
 | 
					  call "%CMDER_ROOT%\config\user_init.cmd"
 | 
				
			||||||
 | 
					  exit /b
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if "%CMDER_CLINK%" == "1" (
 | 
					if "%CMDER_CLINK%" == "1" (
 | 
				
			||||||
    REM TODO: If clink is already injected, goto :CLINK_FINISH
 | 
					 | 
				
			||||||
    goto :INJECT_CLINK
 | 
					    goto :INJECT_CLINK
 | 
				
			||||||
 | 
					) else if "%CMDER_CLINK%" == "2" (
 | 
				
			||||||
 | 
					  goto :CLINK_FINISH
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
goto :SKIP_CLINK
 | 
					goto :SKIP_CLINK
 | 
				
			||||||
@@ -204,11 +217,15 @@ goto :SKIP_CLINK
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
 | 
					    "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
 | 
				
			||||||
 | 
					    set CMDER_CLINK=2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if errorlevel 1 (
 | 
					    if errorlevel 1 (
 | 
				
			||||||
        %print_error% "Clink initialization has failed with error code: %errorlevel%"
 | 
					        %print_error% "Clink initialization has failed with error code: %errorlevel%"
 | 
				
			||||||
 | 
					        goto :CLINK_FINISH
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set CMDER_CLINK=2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    goto :CLINK_FINISH
 | 
					    goto :CLINK_FINISH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:SKIP_CLINK
 | 
					:SKIP_CLINK
 | 
				
			||||||
@@ -296,19 +313,22 @@ if exist "%CMDER_ROOT%\vendor\git-for-windows" (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:SPECIFIED_GIT
 | 
					:SPECIFIED_GIT
 | 
				
			||||||
%print_debug% init.bat "Using /GIT_INSTALL_ROOT..."
 | 
					%print_debug% init.bat "Using specified GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%...."
 | 
				
			||||||
goto :CONFIGURE_GIT
 | 
					goto :CONFIGURE_GIT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:FOUND_GIT
 | 
					:FOUND_GIT
 | 
				
			||||||
%print_debug% init.bat "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..."
 | 
					%print_debug% init.bat "Using found Git '%GIT_VERSION_USER%' from 'v%GIT_INSTALL_ROOT%..."
 | 
				
			||||||
goto :CONFIGURE_GIT
 | 
					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
 | 
				
			||||||
 | 
					%print_debug% init.bat "START - git.exe(prepend): Env Var - PATH=%path%"
 | 
				
			||||||
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" (
 | 
					if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" (
 | 
				
			||||||
  set "path=%GIT_INSTALL_ROOT%\cmd;%path%"
 | 
					  set "path=%GIT_INSTALL_ROOT%\cmd;%path%"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					%print_debug% init.bat "END - git.exe(prepend): Env Var - PATH=%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,6 +339,7 @@ if %nix_tools% equ 1 (
 | 
				
			|||||||
    set "path_position="
 | 
					    set "path_position="
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%print_debug% init.bat "START - nix_tools(%path_position%): Env Var - PATH=%path%"
 | 
				
			||||||
if %nix_tools% geq 1 (
 | 
					if %nix_tools% geq 1 (
 | 
				
			||||||
    if exist "%GIT_INSTALL_ROOT%\mingw32" (
 | 
					    if exist "%GIT_INSTALL_ROOT%\mingw32" (
 | 
				
			||||||
        if "%path_position%" == "append" (
 | 
					        if "%path_position%" == "append" (
 | 
				
			||||||
@@ -341,6 +362,7 @@ if %nix_tools% geq 1 (
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					%print_debug% init.bat "END - nix_tools(%path_position%): Env Var - PATH=%path%"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:SET_ENV
 | 
					:SET_ENV
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -373,8 +395,7 @@ if defined git_locale (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
endlocal && set LANG=%LANG%
 | 
					endlocal && set LANG=%LANG%
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%print_debug% init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
 | 
					%print_debug% init.bat "Found Git in: 'GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%'"
 | 
				
			||||||
%print_debug% init.bat "Found Git in: '%GIT_INSTALL_ROOT%'"
 | 
					 | 
				
			||||||
goto :PATH_ENHANCE
 | 
					goto :PATH_ENHANCE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:NO_GIT
 | 
					:NO_GIT
 | 
				
			||||||
@@ -382,23 +403,33 @@ goto :PATH_ENHANCE
 | 
				
			|||||||
endlocal
 | 
					endlocal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:PATH_ENHANCE
 | 
					:PATH_ENHANCE
 | 
				
			||||||
 | 
					%print_debug% init.bat "START - vendor/bin(prepend): Env Var - PATH=%path%"
 | 
				
			||||||
set "path=%CMDER_ROOT%\vendor\bin;%path%"
 | 
					set "path=%CMDER_ROOT%\vendor\bin;%path%"
 | 
				
			||||||
 | 
					%print_debug% init.bat "END - vendor/bin(prepend): Env Var - PATH=%path%"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:USER_CONFIG_START
 | 
					:USER_CONFIG_START
 | 
				
			||||||
 | 
					%print_debug% init.bat "START - bin(prepend): Env Var - PATH=%path%"
 | 
				
			||||||
if %max_depth% gtr 1 (
 | 
					if %max_depth% gtr 1 (
 | 
				
			||||||
  %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth%
 | 
					  %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth%
 | 
				
			||||||
) else (
 | 
					) else (
 | 
				
			||||||
  set "path=%CMDER_ROOT%\bin;%path%"
 | 
					  set "path=%CMDER_ROOT%\bin;%path%"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					%print_debug% init.bat "END - bin(prepend): Env Var - PATH=%path%"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if defined CMDER_USER_BIN (
 | 
					if defined CMDER_USER_BIN (
 | 
				
			||||||
 | 
					  %print_debug% init.bat "START - user_bin(prepend): Env Var - PATH=%path%"
 | 
				
			||||||
  if %max_depth% gtr 1 (
 | 
					  if %max_depth% gtr 1 (
 | 
				
			||||||
    %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth%
 | 
					    %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth%
 | 
				
			||||||
  ) else (
 | 
					  ) else (
 | 
				
			||||||
    set "path=%CMDER_USER_ROOT%\bin;%path%"
 | 
					    set "path=%CMDER_USER_ROOT%\bin;%path%"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					  %print_debug% init.bat "END - user_bin(prepend): Env Var - PATH=!path!"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%print_debug% init.bat "START - cmder_root(append): Env Var - PATH=%path%"
 | 
				
			||||||
set "path=%path%;%CMDER_ROOT%"
 | 
					set "path=%path%;%CMDER_ROOT%"
 | 
				
			||||||
 | 
					%print_debug% init.bat "END - cmder_root(append): Env Var - PATH=%path%"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:: 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.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user