void SafePluginMap::loadFromDirectory(const char * pluginDirectory) { const char * mask = "*" SharedObjectExtension; Owned<IFile> pluginDir = createIFile(pluginDirectory); Owned<IDirectoryIterator> pluginFiles = pluginDir->directoryFiles(mask,false,false); ForEach(*pluginFiles) { const char *thisPlugin = pluginFiles->query().queryFilename(); StringBuffer tail; splitFilename(thisPlugin, NULL, NULL, &tail, &tail); addPlugin(thisPlugin, tail.str()); } }
bool addFilename(StringAttrArray &names,const char *name,bool sub) { if (isWild(name)) { StringBuffer dir; const char *tail = splitDirTail(name,dir); if (isWild(dir.str())) { printf("Directory %s - cannot be wild!\n",dir.str()); return false; } Owned<IFile> dirf = createIFile(dir.str()); Owned<IDirectoryIterator> iter = dirf->directoryFiles(tail,sub,false); StringBuffer subname; ForEach(*iter) { subname.clear().append(iter->query().queryFilename()); names.append(*new StringAttrItem(subname.str())); } } else
void CConfigHelper::appendBuildSetFromPlugins() { const char *pMask = "*"; StringBuffer strPath(this->m_strConfigXMLDir); strPath.append(STANDARD_CONFIG_CONFIGXML_DIR).append(STANDARD_CONFIG_PLUGIN_DIR_NAME); if (this->m_cbDeployment.get() != NULL) { this->m_cbDeployment->printStatus(STATUS_NORMAL, NULL, NULL, NULL, "Appending plugins to buildset %s", this->m_strBuildSetFilePath.str()); } Owned<IFile> pluginRootDir = createIFile(strPath.str()); if (checkFileExists(strPath.str()) == false) { if (m_cbDeployment.get() != NULL) { m_cbDeployment->printStatus(STATUS_WARN, NULL, NULL, NULL, "Could not find plugin directory at %s", strPath.str()); } return; } Owned<IDirectoryIterator> pluginFiles = pluginRootDir->directoryFiles(pMask, false, true); ForEach(*pluginFiles) { if (pluginFiles->query().isDirectory() == foundYes) { StringBuffer strPluginBuildSetPath; strPluginBuildSetPath.append(pluginFiles->query().queryFilename()).append("/").append(STANDARD_CONFIG_BUILDSETFILE); if (checkFileExists(strPluginBuildSetPath.str()) == true) { StringBuffer strXPath; strXPath.appendf("./%s/%s/%s", XML_TAG_PROGRAMS, XML_TAG_BUILD, XML_TAG_BUILDSET); Owned<IPropertyTree> pPluginBuildSet = createPTreeFromXMLFile(strPluginBuildSetPath.str()); if (m_cbDeployment.get() != NULL) { m_cbDeployment->printStatus(STATUS_NORMAL, NULL, NULL, NULL, "Loading plugin BuildSet from %s", strPluginBuildSetPath.str()); } Owned<IPropertyTreeIterator> pBuildSetIterator = pPluginBuildSet->getElements(strXPath); ForEach(*pBuildSetIterator) { int nIdx = 1; try { m_pDefBldSet->addPropTree(strXPath.str(), LINK(&(pBuildSetIterator->query()))); nIdx++; } catch (IPTreeException *e) { if (m_cbDeployment.get() != NULL) { m_cbDeployment->printStatus(STATUS_ERROR, NULL, NULL, NULL, "Error adding buildset with xpath %s[%d] from location %s", strXPath.str(), nIdx, strPluginBuildSetPath.str()); } delete e; } } } else { if (m_cbDeployment != NULL)