From eb0ab9e4f814567dca99577b266df3aa37df0eaf Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Wed, 19 Sep 2012 22:50:45 +0200 Subject: [PATCH] Restore CWD after calling CFileDialog (fixes issue #1390) (fixes issue #1395) Signed-off-by: Sven Strickroth --- src/Changelog.txt | 2 ++ src/Git/GitStatusListCtrl.cpp | 4 +++- src/TortoiseProc/ExportDlg.cpp | 4 +++- src/TortoiseProc/ImportPatchDlg.cpp | 4 +++- src/TortoiseProc/RepositoryBrowser.cpp | 4 +++- src/TortoiseProc/Settings/SettingGitRemote.cpp | 4 +++- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index ad67d2878..f8ce434fa 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -46,6 +46,8 @@ Released: unreleased * Fixed issue #1382: Log messages with PGP signatures showing badly * Fixed issue #1394: Submodule Diff Dialog cannot jump to a commit that not belongs to current branch * Fixed issue #1387: Submodule Diff Dialog might display wrong submodule revision + * Fixed issue #1390: TortoiseMerge cannot diff files after calling Export in Log Dialog + * Fixed issue #1395: Problem restoring from earlier commit for file in a subdirectory = Release 1.7.12.0 = Released: 2012-08-10 diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index 32f427c36..4829ab511 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -4126,7 +4126,9 @@ void CGitStatusListCtrl::FileSaveAs(CTGitPath *path) dlg.m_ofn.lpstrInitialDir=currentpath.GetBuffer(); CString cmd,out; - if(dlg.DoModal()==IDOK) + INT_PTR ret = dlg.DoModal(); + SetCurrentDirectory(g_Git.m_CurrentDir); + if (ret == IDOK) { filename = dlg.GetPathName(); if(m_CurrentVersion == GIT_REV_ZERO) diff --git a/src/TortoiseProc/ExportDlg.cpp b/src/TortoiseProc/ExportDlg.cpp index ea147d7c2..f48384042 100644 --- a/src/TortoiseProc/ExportDlg.cpp +++ b/src/TortoiseProc/ExportDlg.cpp @@ -177,7 +177,9 @@ void CExportDlg::OnBnClickedCheckoutdirectoryBrowse() this->UpdateRevsionName(); CFileDialog dlg(FALSE, _T("zip"), this->m_VersionName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("*.zip")); - if(dlg.DoModal()==IDOK) + INT_PTR ret = dlg.DoModal(); + SetCurrentDirectory(g_Git.m_CurrentDir); + if (ret == IDOK) { UpdateData(TRUE); m_strExportDirectory = dlg.GetPathName(); diff --git a/src/TortoiseProc/ImportPatchDlg.cpp b/src/TortoiseProc/ImportPatchDlg.cpp index c7f18d464..d6ce563a3 100644 --- a/src/TortoiseProc/ImportPatchDlg.cpp +++ b/src/TortoiseProc/ImportPatchDlg.cpp @@ -255,7 +255,9 @@ void CImportPatchDlg::OnBnClickedButtonAdd() dlg.m_ofn.nMaxFile = 65536; auto_buffer path(dlg.m_ofn.nMaxFile); dlg.m_ofn.lpstrFile = path; - if(dlg.DoModal() == IDOK) + INT_PTR ret = dlg.DoModal(); + SetCurrentDirectory(g_Git.m_CurrentDir); + if (ret == IDOK) { POSITION pos; pos = dlg.GetStartPosition(); diff --git a/src/TortoiseProc/RepositoryBrowser.cpp b/src/TortoiseProc/RepositoryBrowser.cpp index 69de0c54c..465606000 100644 --- a/src/TortoiseProc/RepositoryBrowser.cpp +++ b/src/TortoiseProc/RepositoryBrowser.cpp @@ -948,7 +948,9 @@ void CRepositoryBrowser::FileSaveAs(const CString path) CFileDialog dlg(FALSE, NULL, filename, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, NULL); CString cmd, out; - if (dlg.DoModal() == IDOK) + INT_PTR ret = dlg.DoModal(); + SetCurrentDirectory(g_Git.m_CurrentDir); + if (ret == IDOK) { filename = dlg.GetPathName(); if (g_Git.GetOneFile(m_sRevision, gitPath, filename)) diff --git a/src/TortoiseProc/Settings/SettingGitRemote.cpp b/src/TortoiseProc/Settings/SettingGitRemote.cpp index 9325377fa..67bad622c 100644 --- a/src/TortoiseProc/Settings/SettingGitRemote.cpp +++ b/src/TortoiseProc/Settings/SettingGitRemote.cpp @@ -99,7 +99,9 @@ void CSettingGitRemote::OnBnClickedButtonBrowse() CString(MAKEINTRESOURCE(IDS_PUTTYKEYFILEFILTER))); this->UpdateData(); - if(dlg.DoModal()==IDOK) + INT_PTR ret = dlg.DoModal(); + SetCurrentDirectory(g_Git.m_CurrentDir); + if (ret == IDOK) { this->m_strPuttyKeyfile = dlg.GetPathName(); this->UpdateData(FALSE); -- 2.11.4.GIT