filename +
std::string( "\" does not exist." )
);
+
+ // Check if it was already loaded
+ if( this->m_DynLibraries.find( canonical_fn ) != this->m_DynLibraries.end( ) )
+ return;
+
+ // Ok, try to load the library
void* hnd = Self::_DLOpen( canonical_fn );
if( hnd == NULL )
throw std::runtime_error(
}
// -------------------------------------------------------------------------
-void cpPlugins::Interface::
+unsigned int cpPlugins::Interface::
LoadPluginDir( const std::string& dirname )
{
-#error ACA VOY
- DIR *dir;
- struct dirent *ent;
- if( (dir = opendir ( dirname.c_str( ) ) ) != NULL)
+ DIR* dir;
+ struct dirent* ent;
+ unsigned int count = 0;
+ if( ( dir = opendir( dirname.c_str( ) ) ) != NULL )
{
- while ((ent = readdir (dir)) != NULL) {
- printf ("%s\n", ent->d_name);
- }
- closedir (dir);
- } else {
- std::cerr << "error" << std::endl;
+ while( ( ent = readdir( dir ) ) != NULL )
+ {
+ try
+ {
+ this->LoadPluginFile( ent->d_name );
+ count++;
+ }
+ catch( ... )
+ {
+ // Ignore errors
+ } // yrt
+ } // elihw
+ closedir( dir );
}
+ else
+ throw std::runtime_error(
+ std::string( "cpPlugins::Interface: Could not load directory " ) +
+ std::string( "\"" ) + dirname + std::string( "\"" )
+ );
+ return( count );
}
// -------------------------------------------------------------------------