| 86 | } |
| 87 | |
| 88 | bool CInstrumentFileTree::ScanDirectory(const CStringW &path, CMenu &Menu, int level) { // // // |
| 89 | CFileFind fileFinder; |
| 90 | bool bNoFile = true; |
| 91 | |
| 92 | if (level > RECURSION_LIMIT) |
| 93 | return false; |
| 94 | |
| 95 | BOOL working = fileFinder.FindFile(path + L"\\*.*"); |
| 96 | |
| 97 | // First scan directories |
| 98 | while (working) { |
| 99 | working = fileFinder.FindNextFileW(); |
| 100 | |
| 101 | if (fileFinder.IsDirectory() && !fileFinder.IsHidden() && !fileFinder.IsDots() && m_iTotalMenusAdded++ < MAX_MENUS) { |
| 102 | auto &SubMenu = *m_menuArray.emplace_back(std::make_unique<CMenu>()); // // // |
| 103 | SubMenu.CreatePopupMenu(); |
| 104 | // Recursive scan |
| 105 | bool bEnabled = ScanDirectory(path + L"\\" + fileFinder.GetFileName(), SubMenu, level + 1); |
| 106 | Menu.AppendMenuW(MFT_STRING | MF_POPUP | (bEnabled ? MFS_ENABLED : MFS_DISABLED), (UINT_PTR)SubMenu.m_hMenu, fileFinder.GetFileName()); |
| 107 | bNoFile = false; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | working = fileFinder.FindFile(path + L"\\*.fti"); |
| 112 | |
| 113 | // Then files |
| 114 | while (working) { |
| 115 | working = fileFinder.FindNextFileW(); |
| 116 | Menu.AppendMenuW(MFT_STRING | MFS_ENABLED, MENU_BASE + m_iFileIndex++, fileFinder.GetFileTitle()); |
| 117 | m_fileList.push_back(path + L"\\" + fileFinder.GetFileName()); // // // |
| 118 | bNoFile = false; |
| 119 | } |
| 120 | |
| 121 | return !bNoFile; |
| 122 | } |
| 123 | |
| 124 | CMenu &CInstrumentFileTree::GetMenu() { // // // |
| 125 | return m_RootMenu; |
nothing calls this directly
no test coverage detected