From 60feae4046a49be28580017d0f8212ff142cfd42 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 31 May 2014 12:12:06 +0200 Subject: [PATCH] If entry does not exist any more, explore to nearest matching folder Signed-off-by: Sven Strickroth --- src/Git/GitStatusListCtrl.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index 9c40724c5..d1140e440 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -1850,7 +1850,16 @@ void CGitStatusListCtrl::OnContextMenuList(CWnd * pWnd, CPoint point) case IDGITLC_EXPLORE: { - ShellExecute(this->m_hWnd, _T("explore"), filepath->GetDirectory().GetWinPath(), NULL, NULL, SW_SHOW); + CString p = g_Git.m_CurrentDir + _T("\\") + filepath->GetWinPathString(); + // if filepath does not exist any more, navigate to closest matching folder + while (!PathFileExists(p)) + { + int pos = p.ReverseFind(_T('\\')); + if (pos <= 3) + break; + p = p.Left(pos); + } + ShellExecute(GetSafeHwnd(), _T("explore"), p, nullptr, nullptr, SW_SHOW); } break; -- 2.11.4.GIT