mirror of
https://github.com/cmderdev/cmder.git
synced 2025-02-10 23:49:07 +08:00
fixes for cmd:cmder init script
This commit is contained in:
parent
0cf1c5e2eb
commit
a857d8419c
16
vendor/init.bat
vendored
16
vendor/init.bat
vendored
@ -232,15 +232,17 @@ if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
|
|||||||
|
|
||||||
:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path.
|
:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path.
|
||||||
if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\locale.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe"
|
if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\locale.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe"
|
||||||
if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F")
|
if not defined git_locale for /F "tokens=* delims=" %%F in ('where locale.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" )
|
||||||
if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale
|
if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale
|
||||||
if not defined git_locale set git_locale=env /usr/bin/locale
|
if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" /usr/bin/locale )
|
||||||
|
|
||||||
%lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%"
|
if defined git_locale (
|
||||||
if not defined LANG (
|
%lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%"
|
||||||
for /F "delims=" %%F in ('%git_locale% -uU 2') do (
|
if not defined LANG (
|
||||||
set "LANG=%%F"
|
for /F "delims=" %%F in ('%git_locale% -uU 2') do (
|
||||||
)
|
set "LANG=%%F"
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
|
%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
|
||||||
|
58
vendor/lib/lib_path.cmd
vendored
58
vendor/lib/lib_path.cmd
vendored
@ -57,39 +57,38 @@ exit /b
|
|||||||
) else (
|
) else (
|
||||||
set "PATH=%add_path%;%PATH%"
|
set "PATH=%add_path%;%PATH%"
|
||||||
)
|
)
|
||||||
|
goto :end_enhance_path
|
||||||
)
|
)
|
||||||
|
|
||||||
set "PATH=%PATH:;;=;%"
|
|
||||||
if "%fast_init%" == "1" (
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
rem setlocal enabledelayedexpansion
|
|
||||||
|
|
||||||
set found=0
|
set found=0
|
||||||
set "find_query=%add_path%"
|
set "find_query=%add_path%"
|
||||||
set "find_query=%find_query:\=\\%"
|
set "find_query=%find_query:\=\\%"
|
||||||
set "find_query=%find_query: =\ %"
|
set "find_query=%find_query: =\ %"
|
||||||
|
set OLD_PATH=%PATH%
|
||||||
|
|
||||||
if "%CMDER_CONFIGURED%" == "1" (
|
setlocal enabledelayedexpansion
|
||||||
%lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%"
|
if "%found%" == "0" (
|
||||||
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R ";%find_query%\"$"
|
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%;"
|
||||||
REM if "!ERRORLEVEL!" == "0" set found=1
|
|
||||||
call :set_found
|
call :set_found
|
||||||
)
|
)
|
||||||
%lib_console% debug_output :enhance_path "Env Var 1 - found=%found%"
|
%lib_console% debug_output :enhance_path "Env Var INSIDE PATH %find_query% - found=%found%"
|
||||||
|
|
||||||
if "%found%" == "0" (
|
if /i "%position%" == "append" (
|
||||||
if "%CMDER_CONFIGURED%" == "1" (
|
if "!found!" == "0" (
|
||||||
echo "%path%"|%WINDIR%\System32\findstr >nul /i /r ";%find_query%;"
|
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%\"$"
|
||||||
REM if "!ERRORLEVEL!" == "0" set found=1
|
call :set_found
|
||||||
call :set_found
|
)
|
||||||
)
|
%lib_console% debug_output :enhance_path "Env Var END PATH %find_query% - found=!found!"
|
||||||
%lib_console% debug_output :enhance_path "Env Var 2 - found=%found%"
|
) else (
|
||||||
|
if "!found!" == "0" (
|
||||||
|
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:"^\"%find_query%;"
|
||||||
|
call :set_found
|
||||||
|
)
|
||||||
|
%lib_console% debug_output :enhance_path "Env Var BEGIN PATH %find_query% - found=!found!"
|
||||||
)
|
)
|
||||||
|
endlocal & set found=%found%
|
||||||
|
|
||||||
if "%found%" == "0" (
|
if "%found%" == "0" (
|
||||||
%lib_console% debug_output :enhance_path "BEFORE Env Var - PATH=%path%"
|
|
||||||
if /i "%position%" == "append" (
|
if /i "%position%" == "append" (
|
||||||
%lib_console% debug_output :enhance_path "Appending '%add_path%'"
|
%lib_console% debug_output :enhance_path "Appending '%add_path%'"
|
||||||
set "PATH=%PATH%;%add_path%"
|
set "PATH=%PATH%;%add_path%"
|
||||||
@ -98,16 +97,23 @@ exit /b
|
|||||||
set "PATH=%add_path%;%PATH%"
|
set "PATH=%add_path%;%PATH%"
|
||||||
)
|
)
|
||||||
|
|
||||||
%lib_console% debug_output :enhance_path "AFTER Env Var - PATH=%path%"
|
set found=1
|
||||||
)
|
)
|
||||||
|
|
||||||
rem :end_enhance_path
|
:end_enhance_path
|
||||||
rem endlocal & set "PATH=%PATH:;;=;%"
|
|
||||||
set "PATH=%PATH:;;=;%"
|
set "PATH=%PATH:;;=;%"
|
||||||
|
if NOT "%OLD_PATH%" == "%PATH%" (
|
||||||
|
%lib_console% debug_output :enhance_path "END Env Var - PATH=%path%"
|
||||||
|
%lib_console% debug_output :enhance_path "Env Var %find_query% - found=%found%"
|
||||||
|
)
|
||||||
|
set "position="
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:set_found
|
:set_found
|
||||||
if "!ERRORLEVEL!" == "0" set found=1
|
if "%ERRORLEVEL%" == "0" (
|
||||||
|
set found=1
|
||||||
|
)
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:enhance_path_recursive
|
:enhance_path_recursive
|
||||||
@ -165,7 +171,6 @@ exit /b
|
|||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
rem setlocal enabledelayedexpansion
|
|
||||||
if "%depth%" == "" set depth=0
|
if "%depth%" == "" set depth=0
|
||||||
|
|
||||||
%lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%"
|
%lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%"
|
||||||
@ -175,13 +180,10 @@ exit /b
|
|||||||
if %max_depth% gtr %depth% (
|
if %max_depth% gtr %depth% (
|
||||||
%lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'"
|
%lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'"
|
||||||
call :enhance_path "%add_path%" %position%
|
call :enhance_path "%add_path%" %position%
|
||||||
REM set /a "depth=!depth!+1"
|
|
||||||
call :set_depth
|
call :set_depth
|
||||||
call :loop_depth
|
call :loop_depth
|
||||||
)
|
)
|
||||||
|
|
||||||
rem :end_enhance_path_recursive
|
|
||||||
rem endlocal & set "PATH=%PATH%"
|
|
||||||
set "PATH=%PATH%"
|
set "PATH=%PATH%"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user