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

◆ getDirSos()

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

Definition at line 116 of file PluginLoader.cpp.

References filter().

Referenced by PluginLoader::loadPlugins().

117 {
118  struct dirent *dirent;
119 
120  const char *ds = dir.c_str();
121  DIR *dirfd = opendir(ds);
122  if (!dirfd) {
123  std::string er =
124  "Field3D_plugin loader: could not open directory " + dir + "\n";
125  //perror(er.c_str());
126  return false;
127  }
128 
129  dirent = readdir(dirfd);
130  while (dirent != NULL) {
131 
132  std::string name = dirent->d_name;
133 
134  if (filter(name)) {
135  name = dir + "/" + name;
136  sos.push_back(name);
137  }
138 
139  dirent = readdir(dirfd);
140  }
141 
142  closedir(dirfd);
143 
144  return true;
145 }
int filter(std::string &name)