From 9e55c4820006b15d91744e5b6f52c69782db084c Mon Sep 17 00:00:00 2001 From: David Refoua Date: Wed, 21 Dec 2022 02:29:31 +0330 Subject: [PATCH] fix checking for clink injection --- vendor/init.bat | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index a6ae141..62a6112 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -166,11 +166,19 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( ) if "%CMDER_CLINK%" == "1" ( + REM TODO: If clink is already injected, goto :CLINK_FINISH + goto :INJECT_CLINK +) + +goto :SKIP_CLINK + +:INJECT_CLINK %print_verbose% "Injecting Clink!" :: Check if Clink is not present if not exist "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" ( %print_error% "Clink executable is not present in 'vendor\clink\clink_%clink_architecture%.exe'" + goto :SKIP_CLINK ) :: Run Clink @@ -200,7 +208,10 @@ if "%CMDER_CLINK%" == "1" ( if errorlevel 1 ( %print_error% "Clink initilization has failed with error code: %errorlevel%" ) -) else ( + + goto :CLINK_FINISH + +:SKIP_CLINK %print_warning% "Skipping Clink Injection!" for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x @@ -210,7 +221,8 @@ if "%CMDER_CLINK%" == "1" ( prompt $E[1;32;49m$P$S$_$E[1;30;49mλ$S$E[0m chcp %cp%>nul -) + +:CLINK_FINISH if "%CMDER_CONFIGURED%" GTR "1" ( %print_verbose% "Cmder is already configured, skipping Cmder Init!"