- std::stringstream fname;
- fname << *d << cpPlugins_PATH_SEPARATOR << cpPlugins_CONFIG;
- std::string buffer;
- if( cpExtensions::Read( buffer, fname.str( ) ) )
- {
- std::istringstream input( buffer );
- for( std::string line; std::getline( input, line ); )
- {
- std::vector< std::string > tokens;
- cpExtensions::Tokenize( tokens, line, "|" );
- if( tokens.size( ) == 2 )
- {
- std::string pth = tokens[ 0 ];
- std::string lib = tokens[ 1 ];
- if( lib.find( "*" ) != std::string::npos )
- {
- std::string ext( cpPlugins_LIB_EXT );
- DIR* dir;
- struct dirent* ent;
- if( ( dir = opendir( pth.c_str( ) ) ) != NULL )
- {
- while( ( ent = readdir( dir ) ) != NULL )
- {
- std::string fname( ent->d_name );
- long pos = long( fname.size( ) ) - long( ext.size( ) );
- if( pos > 0 )
- {
- if( fname.substr( pos ) == ext )
- {
- std::regex re( lib );
-std::smatch match;
-if( std::regex_search( fname, match, re ) && match.size( ) >= 1 )
- {
- std::stringstream str;
- str
- << pth << cpPlugins_PATH_SEPARATOR << fname;
- libs.insert( str.str( ) );
- } // fi
-
- } // fi
-
- } // fi
-
- } // elihw
- closedir( dir );
-
- } // fi
- }
- else
- {
- std::stringstream str;
- str
- << pth << cpPlugins_PATH_SEPARATOR << cpPlugins_LIB_PREFIX
- << lib << cpPlugins_LIB_EXT;
- libs.insert( str.str( ) );
-
- } // fi
-
- } // fi
-
- } // rof
-
- } // fi
-
- } // rof
- for( auto l = libs.begin( ); l != libs.end( ); ++l )
- {
- std::string lib = cpExtensions::CanonicalPath( *l );
- if( lib != "" )
- {
- if( this->m_Libraries.find( lib ) == this->m_Libraries.end( ) )
-{
- std::string error = "";
- void* hnd = cpPlugins::OS::DLLManager::Load( lib, error );
- if( hnd != NULL )
- this->m_Libraries[ lib ] = hnd;
-
-} // fi
-
- } // fi