From 1ea4cfcad0446181bb7c461dd2cd968918f1c4c9 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 29 Nov 2016 09:57:29 +0100 Subject: [PATCH] Use file selector for choosing git.exe instead of folder selector This should make it a bit easier to choose git.exe. Signed-off-by: Sven Strickroth --- Languages/Tortoise.pot | 4 ++++ src/Resources/TortoiseProcENG.rc | 1 + src/TortoiseProc/ConfigureGitExe.h | 10 +++------- src/TortoiseProc/resource.h | 1 + src/Utils/CommonAppUtils.cpp | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Languages/Tortoise.pot b/Languages/Tortoise.pot index af25056bb..2f344e10a 100644 --- a/Languages/Tortoise.pot +++ b/Languages/Tortoise.pot @@ -11061,6 +11061,10 @@ msgstr "" msgid "git did not exit cleanly (exit code %d)" msgstr "" +#. Resource IDs: (IDS_GITEXEFILEFILTER) +msgid "git.exe|git.exe||" +msgstr "" + #. Resource IDs: (IDS_STATUSIGNORED) msgid "ignored" msgstr "" diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 1b9e7ffe3..43ffb8567 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -4845,6 +4845,7 @@ BEGIN IDS_ERR_GITUNNEEDEDHACKS "Found ""msysgit"" or ""windows"" in versionstring of git.exe, however, you have git.exe hacks enabled. These hacks must be disabled for proper operation with Git for Windows!\nYou can find more information in the help file for the keyword ""cygwin git"" or ""msys2 git""." IDS_ERR_GITCALLFAILED "Calling git.exe failed (exit code: %d). Please check the git.exe path." + IDS_GITEXEFILEFILTER "git.exe|git.exe||" END #endif // English (U.S.) resources diff --git a/src/TortoiseProc/ConfigureGitExe.h b/src/TortoiseProc/ConfigureGitExe.h index f558e31b7..cd822fad1 100644 --- a/src/TortoiseProc/ConfigureGitExe.h +++ b/src/TortoiseProc/ConfigureGitExe.h @@ -19,8 +19,6 @@ #pragma once #include "StringUtils.h" -#include "BrowseFolder.h" -#include "PathUtils.h" #include "Git.h" #include "MessageBox.h" #include "AppUtils.h" @@ -112,13 +110,11 @@ protected: static bool SelectFolder(HWND hwnd, CString& gitpath, CString& pathaddition) { - CBrowseFolder browseFolder; - browseFolder.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; CString dir; dir = gitpath; - if (dir.IsEmpty()) - dir = CPathUtils::GetProgramsDirectory(); - if (browseFolder.Show(hwnd, dir) != CBrowseFolder::OK) + if (!dir.IsEmpty()) + dir += L"\\git.exe"; + if (!CCommonAppUtils::FileOpenSave(dir, nullptr, 0, IDS_GITEXEFILEFILTER, true, hwnd)) return false; gitpath = dir; diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index f10168611..c4fea7080 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -1314,6 +1314,7 @@ #define IDC_GROUP_INFO 1624 #define IDS_ERR_GITCALLFAILED 1624 #define IDC_BUTTON_COMMIT 1625 +#define IDS_GITEXEFILEFILTER 1625 #define IDC_CHECK_DIR 1626 #define IDC_RADIO_CLEAN_ALL 1627 #define IDC_RADIO_CLEAN_NO 1628 diff --git a/src/Utils/CommonAppUtils.cpp b/src/Utils/CommonAppUtils.cpp index 129420dc1..d267e3fe6 100644 --- a/src/Utils/CommonAppUtils.cpp +++ b/src/Utils/CommonAppUtils.cpp @@ -255,7 +255,7 @@ bool CCommonAppUtils::FileOpenSave(CString& path, int* filterindex, UINT title, CSelectFileFilter fileFilter(filterId); if (!SUCCEEDED(pfd->SetFileTypes(fileFilter.GetCount(), fileFilter))) return false; - if (filterId == 2501) // IDS_PROGRAMSFILEFILTER + if (filterId == 1602 || filterId == 2501) // IDS_GITEXEFILEFILTER || IDS_PROGRAMSFILEFILTER { pfd->SetClientGuid({ 0x323ca4b0, 0x62df, 0x4a08, { 0xa5, 0x5, 0x58, 0xde, 0xa2, 0xb9, 0x2d, 0xcd } }); if (SUCCEEDED(SHCreateItemFromParsingName(CPathUtils::GetProgramsDirectory(), nullptr, IID_PPV_ARGS(&psiDefaultFolder)))) -- 2.11.4.GIT