DirectoryList& DirectoryInfo::getSubDirs(bool refresh) { if ( m_exist && (subDirs.size() == 0 || refresh)) { subDirs.clear(); std::string start_pos = fullname + "\\*"; HANDLE hFind; WIN32_FIND_DATAA find_data = {0}; hFind = FindFirstFileA(start_pos.c_str(), &find_data); if (hFind != INVALID_HANDLE_VALUE) { if((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { std::string filename = find_data.cFileName; if(filename != "." && filename != "..") subDirs.push_back(DirectoryPtr(createDirectoryInfo(*this,find_data))); } while (FindNextFileA(hFind, &find_data) != 0) { if((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { std::string filename = find_data.cFileName; if(filename == "." || filename == "..") continue; subDirs.push_back(DirectoryPtr(createDirectoryInfo(*this,find_data))); } } FindClose(hFind); } } return subDirs; }
DirectoryPtr IndexReader::directory() { ensureOpen(); boost::throw_exception(UnsupportedOperationException(L"This reader does not support this method.")); return DirectoryPtr(); }