From 28e9018ce0673398e9ca4d2102843e4a5c06cb27 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 27 Nov 2023 10:00:28 -0500 Subject: [PATCH] make mintty /a work --- launcher/src/CmderLauncher.cpp | 8 +++++++ vendor/start_git_mintty.cmd | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 vendor/start_git_mintty.cmd diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index e8a13e4..782095d 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -135,6 +135,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t initCmd[MAX_PATH] = { 0 }; wchar_t initPowerShell[MAX_PATH] = { 0 }; wchar_t initBash[MAX_PATH] = { 0 }; + wchar_t initMintty[MAX_PATH] = { 0 }; wchar_t vendoredGit[MAX_PATH] = { 0 }; wchar_t amdx64Git[MAX_PATH] = { 0 }; wchar_t x86Git[MAX_PATH] = { 0 }; @@ -528,6 +529,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { PathCombine(terminalPath, winDir, L"System32\\WindowsPowerShell\\v1.0\\powershell.exe"); } + /* else if (streqi(cmderTask.c_str(), L"mintty")) { if (PathFileExists(vendoredGit)) @@ -543,6 +545,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(terminalPath, x86Git, L"git-bash.exe"); } } + */ } if (!streqi(cmderStart.c_str(), L"")) @@ -581,6 +584,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(initCmd, vendorDir, L"init.bat"); PathCombine(initPowerShell, vendorDir, L"profile.ps1"); PathCombine(initBash, vendorDir, L"start_git_bash.cmd"); + PathCombine(initMintty, vendorDir, L"start_git_mintty.cmd"); if (!streqi(cmderTask.c_str(), L"")) { @@ -601,6 +605,10 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { swprintf_s(args, L"%s /c \"%s\"", args, initBash); } + else if (streqi(cmderTask.c_str(), L"mintty")) + { + swprintf_s(args, L"%s /c \"%s\"", args, initMintty); + } else if (streqi(cmderTask.c_str(), L"cmder")) { swprintf_s(args, L"%s /k \"%s\"", args, initCmd); diff --git a/vendor/start_git_mintty.cmd b/vendor/start_git_mintty.cmd new file mode 100644 index 0000000..ea4f09a --- /dev/null +++ b/vendor/start_git_mintty.cmd @@ -0,0 +1,40 @@ +@echo off + +if not defined CMDER_ROOT ( + if defined ConEmuDir ( + for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) else ( + for /f "delims=" %%i in ("%~dp0\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) +) + +if exist "%CMDER_ROOT%\vendor\git-for-windows" ( + set "PATH=%CMDER_ROOT%\vendor\git-for-windows\usr\bin;%PATH%" + set "gitCmd=%CMDER_ROOT%\vendor\git-for-windows\usr\bin\mintty.exe" +) else if exist "%ProgramFiles%\git" ( + set "PATH=%ProgramFiles%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles%\git\usr\bin\mintty.exe" + if not exist "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) else if exist "%ProgramFiles(x86)%\git" ( + set "PATH=%ProgramFiles(x86)%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles(x86)%\git\usr\bin\mintty.exe" + if not exist "%ProgramFiles(x86)%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) + +"%gitCmd%" /bin/bash -l