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 125 of file PluginLoader.cpp.

126{
127#ifdef WIN32
128 const char *ds = dir.c_str();
129 HANDLE dirh;
131
133 while (dirh != INVALID_HANDLE_VALUE)
134 {
135 std::string name = fd.cFileName;
136 std::string name_lower;
137
138 std::transform(name.begin(), name.end(), name_lower.begin(), ::tolower);
139
140 if (filter(name_lower, "so")) {
141 name = dir + "/" + name;
142 sos.push_back(name);
143 }
144
145 if (!FindNextFileA(dirh, &fd))
146 {
148 break;
149 }
150 }
151#else
152 struct dirent *dirent;
153
154 const char *ds = dir.c_str();
155 DIR *dirfd = opendir(ds);
156 if (!dirfd) {
157 std::string er =
158 "Field3D_plugin loader: could not open directory " + dir + "\n";
159 //perror(er.c_str());
160 return false;
161 }
162
164 while (dirent != NULL) {
165
166 std::string name = dirent->d_name;
167
168 if (filter(name, "so")) {
169 name = dir + "/" + name;
170 sos.push_back(name);
171 }
172
174 }
175
177#endif
178 return true;
179}
static int filter(std::string &name, const char *suffix)
#define FIELD3D_MTX_T
Definition StdMathLib.h:99

References FIELD3D_MTX_T, and filter().

Referenced by PluginLoader::loadPlugins().