Пример #1
0
void SafePluginMap::loadFromList(const char * pluginsList)
{
    const char *pluginDir = pluginsList;
    for (;*pluginDir;)
    {
        StringBuffer thisPlugin;
        while (*pluginDir && *pluginDir != ENVSEPCHAR)
            thisPlugin.append(*pluginDir++);
        if(*pluginDir)
            pluginDir++;

        if(!thisPlugin.length())
            continue;

        Owned<IFile> file = createIFile(thisPlugin.str());
        if (file->isDirectory() == foundYes)
            loadFromDirectory(thisPlugin);
        else
        {
            StringBuffer tail;
            splitFilename(thisPlugin, NULL, NULL, &tail, &tail);
            addPlugin(thisPlugin, tail.str());
        }
    }
}
Пример #2
0
 void PluginContainer::loadFromDirectory(char const *path) throw(PluginLoadException) {
   io::directory::list(path, [this] (std::string const &child) {
     if (io::directory::isDirectory(child)) {
       loadFromDirectory(child.c_str());
     } else if (io::path::hasExtension(child, system::Library::getFileExtension())) {
       loadFromFile(child.c_str());
     }
   });
 }
Пример #3
0
    PluginContainer::PluginContainer(Application &application, std::string pluginDir)
      throw(PluginLoadException) :
      application(application),
      pluginDir(std::move(pluginDir))
    {
      if (io::path::exists(this->pluginDir.c_str())) {
        loadFromDirectory(this->pluginDir.c_str());
      }

      for (auto &plugin : plugins) {
        try {
          plugin.second->load();
        } catch (Plugin::PluginLoadException&) {
          throw PluginLoadException();
        }
      }
    }