MCPcopy Create free account
hub / github.com/TortoiseGit/TortoiseGit / OpenFile

Method OpenFile

src/Git/GitStatusListCtrl.cpp:4673–4700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4671}
4672
4673void CGitStatusListCtrl::OpenFile(const CTGitPath* filepath, int mode)
4674{
4675 CString file;
4676 if (m_CurrentVersion.IsEmpty())
4677 file = g_Git.CombinePath(filepath);
4678 else
4679 {
4680 file = CTempFiles::Instance().GetTempFilePath(false, *filepath, m_CurrentVersion).GetWinPathString();
4681 CString cmd,out;
4682 if(g_Git.GetOneFile(m_CurrentVersion.ToString(), *filepath, file))
4683 {
4684 out.FormatMessage(IDS_STATUSLIST_CHECKOUTFILEFAILED, static_cast<LPCWSTR>(filepath->GetGitPathString()), static_cast<LPCWSTR>(m_CurrentVersion.ToString()), static_cast<LPCWSTR>(file));
4685 CMessageBox::Show(GetParentHWND(), g_Git.GetGitLastErr(out, CGit::GIT_CMD_GETONEFILE), L"TortoiseGit", MB_OK);
4686 return;
4687 }
4688 SetFileAttributes(file, FILE_ATTRIBUTE_READONLY);
4689 }
4690 if(mode == ALTERNATIVEEDITOR)
4691 {
4692 CAppUtils::LaunchAlternativeEditor(file);
4693 return;
4694 }
4695
4696 if (mode == OPEN)
4697 CAppUtils::ShellOpen(file, GetSafeHwnd());
4698 else
4699 CAppUtils::ShowOpenWithDialog(file, GetSafeHwnd());
4700}
4701
4702void CGitStatusListCtrl::DeleteSelectedFiles()
4703{

Callers

nothing calls this directly

Calls 6

CombinePathMethod · 0.80
GetOneFileMethod · 0.80
GetGitLastErrMethod · 0.80
IsEmptyMethod · 0.45
GetTempFilePathMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected