本文整理汇总了C++中IFileSystem::getFileList方法的典型用法代码示例。如果您正苦于以下问题:C++ IFileSystem::getFileList方法的具体用法?C++ IFileSystem::getFileList怎么用?C++ IFileSystem::getFileList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFileSystem
的用法示例。
在下文中一共展示了IFileSystem::getFileList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileSystem
void ModuleManager::scanModuleDir()
{
if (RootConfig::isSet("ModulesDir") == false)
{
Logger::getInstance() << Logger::Warning << "No modules dir specified. No module will be loaded" << Logger::Flush;
return ;
}
//Retreiving modules in ModulesDir
IFileSystem* fs = new FileSystem(RootConfig::getParamChar("ModulesDir"));
#ifndef _WIN32
std::list<IFile*>* files = fs->getFileList("so");
#else
std::list<IFile*>* files = fs->getFileList("dll");
#endif // !_WIN32
if (files != NULL)
{
//Creating a new modules list
ModuleStuff newStuff;
std::list<RefCounter<zAPI::IModuleInfo*>*>* newList = new std::list<RefCounter<zAPI::IModuleInfo*>*>[zAPI::IModule::NumberOfHooks];
newStuff.list = NULL;
newStuff.hooks = newList;
//duplicating old list, to apply changes from the old one to the new one
if (this->_modules.size() > 0)
{
for (int i = 0; i < zAPI::IModule::NumberOfHooks; ++i)
newList[i] = this->_modules.back().ptr.hooks[i];
}
//flag to see if some changes occured.
bool firstChange = true;
//files list iterators
std::list<IFile*>::iterator it;
std::list<IFile*>::iterator ite = files->end();
//modules instance iterators
std::list<RefCounter<zAPI::IModuleInfo*> >::iterator mIt = this->_moduleInstances.begin();
std::list<RefCounter<zAPI::IModuleInfo*> >::iterator mIte = this->_moduleInstances.end();
//First we look if some modules doesn't exists anymore.
for (; mIt != mIte; ++mIt)
{
for (it = files->begin(); it != ite; ++it)
{
if ((*it)->getFullFileName() == (*mIt).ptr->getFileName())
break;
}
if (it == ite) //module wasn't in dir anymore : unloading
{
if (firstChange)
{
this->_modules.push_back(newStuff);
this->_modules.back().count = 0;
firstChange = false;
}
Logger::getInstance() << Logger::Info << (*mIt).ptr->getFileName() << " is missing from ModulesDir. Unloading module." << Logger::Flush;
this->unload((*mIt).ptr->getFileName());
if ((*mIt).count == 0)
{
mIt = this->_moduleInstances.erase(mIt);
mIte = this->_moduleInstances.end();
}
}
}
//Then we add new modules
it = files->begin();
for (; it != ite; ++it)
{
if (this->isLoaded((*it)->getFullFileName()) == false)
{
if (firstChange)
{
this->_modules.push_back(newStuff);
this->_modules.back().count = 0;
firstChange = false;
}
this->load((*it)->getFullFileName());
}
}
if (firstChange == true)
delete[] newList;
else
this->createModuleStuff();
}
delete fs;
}