# include <dlfcn.h>
#endif // cpPlugins_SYS_WINDOWS
#include <cpPlugins_dirent.h>
+#include <algorithm>
// -------------------------------------------------------------------------
cpPlugins::Interface::
return( this->m_Filters );
}
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::
+GuessAccesiblePlugins( )
+{
+ // Load environment configuration
+ char* path = std::getenv( "cpPlugins_PATHS" );
+ if( path != NULL )
+ {
+ std::vector< std::string > tokens;
+ cpPlugins::TokenizeString( tokens, path, "#" );
+ for( auto tIt = tokens.begin( ); tIt != tokens.end( ); ++tIt )
+ try { this->LoadPluginDir( *tIt ); } catch( ... ) { }
+
+ } // fi
+
+ // Load local path
+ auto lpath = cpPlugins::CanonicalPath( "." );
+ try { this->LoadPluginDir( lpath ); } catch( ... ) { }
+}
+
// -------------------------------------------------------------------------
bool cpPlugins::Interface::
LoadConfiguration( const std::string& filename )
this->UnloadAll( );
std::string line;
while( std::getline( in, line ) )
- {
- try
- {
- this->LoadPluginFile( line );
- }
- catch( ... )
- {
- // Do nothing
-
- } // yrt
-
- } // elihw
+ try { this->LoadPluginFile( line ); } catch( ... ) { }
return( true );
}
);
// Check if it was already loaded
- if( this->m_DynLibraries.find( canonical_fn ) != this->m_DynLibraries.end( ) )
+ if(
+ this->m_DynLibraries.find( canonical_fn ) != this->m_DynLibraries.end( )
+ )
return;
// Ok, try to load the library
{
try
{
- this->LoadPluginFile( ent->d_name );
+ this->LoadPluginFile(
+ dirname +
+ std::string( "/" ) +
+ ent->d_name
+ );
count++;
}
- catch( ... )
- {
- // Ignore errors
- } // yrt
+ catch( ... ) { }
+
} // elihw
closedir( dir );
}