Field3D
PluginLoader.h File Reference

Contains the PluginLoader class. More...

#include <string>
#include <vector>
#include "ns.h"

Go to the source code of this file.

Classes

class  PluginLoader
 This class provides methods for loading Field plugins from disk. More...

Functions

bool getDirSos (std::vector< std::string > &sos, std::string &dir)

Detailed Description

Contains the PluginLoader class.

Definition in file PluginLoader.h.


Function Documentation

bool getDirSos ( std::vector< std::string > &  sos,
std::string &  dir 
)

Definition at line 116 of file PluginLoader.cpp.

References filter().

Referenced by PluginLoader::loadPlugins().

{
  struct dirent *dirent;

  const char *ds = dir.c_str();
  DIR *dirfd = opendir(ds);
  if (!dirfd) {
    std::string er =
      "Field3D_plugin loader: could not open directory " + dir + "\n"; 
    //perror(er.c_str());
    return false;
  }
  
  dirent = readdir(dirfd);
  while (dirent != NULL) {

    std::string name = dirent->d_name;

    if (filter(name)) {
      name = dir + "/" + name;
      sos.push_back(name);
    }

    dirent = readdir(dirfd);
  }

  closedir(dirfd);
  
  return true;
}