void ADLSearchManager::prepareDestinationDirectories(DestDirList& destDirVector, DirectoryListing::Directory* root, StringMap& params) { // Load default destination directory (index = 0) destDirVector.clear(); auto id = destDirVector.insert(destDirVector.end(), DestDir()); id->name = "ADLSearch"; id->dir = new DirectoryListing::Directory(nullptr, root, "<<<" + id->name + ">>>", true, true, true); // Scan all loaded searches for (auto is = collection.begin(); is != collection.end(); ++is) { // Check empty destination directory if (is->destDir.empty()) { // Set to default is->ddIndex = 0; continue; } // Check if exists bool isNew = true; long ddIndex = 0; for (id = destDirVector.begin(); id != destDirVector.end(); ++id, ++ddIndex) { if (stricmp(is->destDir.c_str(), id->name.c_str()) == 0) { // Already exists, reuse index is->ddIndex = ddIndex; isNew = false; break; } } if (isNew) { // Add new destination directory id = destDirVector.insert(destDirVector.end(), DestDir()); id->name = is->destDir; id->dir = new DirectoryListing::Directory(nullptr, root, "<<<" + id->name + ">>>", true, true, true); is->ddIndex = ddIndex; } } // Prepare all searches for (auto ip = collection.begin(); ip != collection.end(); ++ip) { ip->prepare(params); } }
void ADLSearchManager::prepareDestinationDirectories(DestDirList& destDirs, DirectoryListing::Directory* root, StringMap ¶ms) { // Load default destination directory (index = 0) destDirs.clear(); DestDir dir = { "ADLSearch", new DirectoryListing::Directory(root, "<<<ADLSearch>>>", true, true), nullptr, false }; destDirs.push_back(std::move(dir)); // Scan all loaded searches for(auto& is: collection) { // Check empty destination directory if(is.destDir.empty()) { // Set to default is.ddIndex = 0; continue; } // Check if exists bool isNew = true; long ddIndex = 0; for(auto id = destDirs.cbegin(); id != destDirs.cend(); ++id, ++ddIndex) { if(Util::stricmp(is.destDir.c_str(), id->name.c_str()) == 0) { // Already exists, reuse index is.ddIndex = ddIndex; isNew = false; break; } } if(isNew) { // Add new destination directory DestDir dir = { is.destDir, new DirectoryListing::Directory(root, "<<<" + is.destDir + ">>>", true, true), nullptr, false }; destDirs.push_back(std::move(dir)); is.ddIndex = ddIndex; } } // Prepare all searches for(auto& ip: collection) { ip.prepare(params); } }