make mintty /a work

This commit is contained in:
Dax T. Games 2023-11-27 10:00:28 -05:00
parent 38a91ded02
commit 28e9018ce0
2 changed files with 48 additions and 0 deletions

View File

@ -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 initCmd[MAX_PATH] = { 0 };
wchar_t initPowerShell[MAX_PATH] = { 0 }; wchar_t initPowerShell[MAX_PATH] = { 0 };
wchar_t initBash[MAX_PATH] = { 0 }; wchar_t initBash[MAX_PATH] = { 0 };
wchar_t initMintty[MAX_PATH] = { 0 };
wchar_t vendoredGit[MAX_PATH] = { 0 }; wchar_t vendoredGit[MAX_PATH] = { 0 };
wchar_t amdx64Git[MAX_PATH] = { 0 }; wchar_t amdx64Git[MAX_PATH] = { 0 };
wchar_t x86Git[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"); PathCombine(terminalPath, winDir, L"System32\\WindowsPowerShell\\v1.0\\powershell.exe");
} }
/*
else if (streqi(cmderTask.c_str(), L"mintty")) else if (streqi(cmderTask.c_str(), L"mintty"))
{ {
if (PathFileExists(vendoredGit)) 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"); PathCombine(terminalPath, x86Git, L"git-bash.exe");
} }
} }
*/
} }
if (!streqi(cmderStart.c_str(), L"")) 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(initCmd, vendorDir, L"init.bat");
PathCombine(initPowerShell, vendorDir, L"profile.ps1"); PathCombine(initPowerShell, vendorDir, L"profile.ps1");
PathCombine(initBash, vendorDir, L"start_git_bash.cmd"); PathCombine(initBash, vendorDir, L"start_git_bash.cmd");
PathCombine(initMintty, vendorDir, L"start_git_mintty.cmd");
if (!streqi(cmderTask.c_str(), L"")) 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); 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")) else if (streqi(cmderTask.c_str(), L"cmder"))
{ {
swprintf_s(args, L"%s /k \"%s\"", args, initCmd); swprintf_s(args, L"%s /k \"%s\"", args, initCmd);

40
vendor/start_git_mintty.cmd vendored Normal file
View File

@ -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