MCPcopy Create free account
hub / github.com/WinMerge/winmerge / OnPathButton

Method OnPathButton

Src/OpenView.cpp:642–674  ·  view source on GitHub ↗

* @brief Called when "Browse..." button is selected for N path. */

Source from the content-addressed store, hash-verified

640 * @brief Called when "Browse..." button is selected for N path.
641 */
642void COpenView::OnPathButton(UINT nId)
643{
644 const int index = nId - IDC_PATH0_BUTTON;
645 String s;
646 String sfolder;
647 UpdateData(TRUE);
648
649 paths::PATH_EXISTENCE existence = paths::DoesPathExist(m_strPath[index]);
650 switch (existence)
651 {
652 case paths::IS_EXISTING_DIR:
653 sfolder = m_strPath[index];
654 break;
655 case paths::IS_EXISTING_FILE:
656 sfolder = paths::GetPathOnly(m_strPath[index]);
657 break;
658 case paths::DOES_NOT_EXIST:
659 if (!m_strPath[index].empty())
660 sfolder = paths::GetParentPath(m_strPath[index]);
661 break;
662 default:
663 _RPTF0(_CRT_ERROR, "Invalid return value from paths::DoesPathExist()");
664 break;
665 }
666
667 if (SelectFileOrFolder(GetSafeHwnd(), s, sfolder.c_str()))
668 {
669 m_strPath[index] = s;
670 m_strBrowsePath[index] = std::move(s);
671 UpdateData(FALSE);
672 UpdateButtonStates();
673 }
674}
675
676void COpenView::OnSwapButton(int id1, int id2)
677{

Callers

nothing calls this directly

Calls 5

DoesPathExistFunction · 0.85
GetPathOnlyFunction · 0.85
GetParentPathFunction · 0.85
SelectFileOrFolderFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected