From f29507a7586aa167b0faa773e3a5acfe6cd8d17a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 28 Mar 2015 15:06:22 +0100 Subject: [PATCH] Let the Git wrapper replace cmd\gitk.cmd, too In a push to polish Git for Windows more, we are moving away from scripts toward proper binaries. Signed-off-by: Johannes Schindelin --- compat/win32/git-wrapper.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/compat/win32/git-wrapper.c b/compat/win32/git-wrapper.c index 0dc2ae698b..2c78048786 100644 --- a/compat/win32/git-wrapper.c +++ b/compat/win32/git-wrapper.c @@ -322,6 +322,30 @@ int main(void) PathAppend(exe, L"bin\\git.exe"); } } + else if (!wcscmp(basename, L"gitk.exe")) { + static WCHAR buffer[BUFSIZE]; + if (!PathRemoveFileSpec(exepath)) { + fwprintf(stderr, + L"Invalid executable path: %s\n", exepath); + ExitProcess(1); + } + + /* set the default exe module */ + wcscpy(exe, exepath); + wcscpy(buffer, exepath); + PathAppend(exe, msystem_bin); + PathAppend(exe, L"wish.exe"); + if (_waccess(exe, 0) != -1) + PathAppend(buffer, msystem_bin); + else { + wcscpy(exe, exepath); + PathAppend(exe, L"mingw\\bin\\wish.exe"); + PathAppend(buffer, L"mingw\\bin"); + } + PathAppend(buffer, L"gitk"); + prefix_args = buffer; + prefix_args_len = wcslen(buffer); + } if (needs_env_setup) setup_environment(exepath);