MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / ScanDirectory

Method ScanDirectory

Source/InstrumentFileTree.cpp:88–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88bool 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
124CMenu &CInstrumentFileTree::GetMenu() { // // //
125 return m_RootMenu;

Callers

nothing calls this directly

Calls 1

GetFileTitleMethod · 0.80

Tested by

no test coverage detected