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.

{
#ifdef WIN32
const char *ds = dir.c_str();
HANDLE dirh;
WIN32_FIND_DATAA fd;
dirh = FindFirstFileA(ds, &fd);
while (dirh != INVALID_HANDLE_VALUE)
{
std::string name = fd.cFileName;
std::string name_lower;
std::transform(name.begin(), name.end(), name_lower.begin(), ::tolower);
if (filter(name_lower, "so")) {
name = dir + "/" + name;
sos.push_back(name);
}
if (!FindNextFileA(dirh, &fd))
{
::FindClose(dirh);
break;
}
}
#else
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, "so")) {
name = dir + "/" + name;
sos.push_back(name);
}
dirent = readdir(dirfd);
}
closedir(dirfd);
#endif
return true;
}
filter
static int filter(std::string &name, const char *suffix)
Definition PluginLoader.cpp:105

References filter().

Referenced by PluginLoader::loadPlugins().