]> Creatis software - cpPlugins.git/blob - tools/PrintDirInfo.cxx
0c00f791da54daf4483c6aa151c02e81448e59be
[cpPlugins.git] / tools / PrintDirInfo.cxx
1 #include <iostream>
2 #include <cpPlugins/Interface/Loader.h>
3
4 int main( int argc, char* argv[] )
5 {
6   if( argc < 2 )
7   {
8     std::cerr << "Usage: " << argv[ 0 ] << " library" << std::endl;
9     return( 1 );
10
11   } // fi
12
13   // Get plugins loader
14   std::string error_message = "";
15   cpPlugins::Interface::Loader loader;
16   for( int i = 1; i < argc; ++i )
17   {
18     try
19     {
20       loader.RegisterFromDirectory( argv[ i ] );
21     }
22     catch( std::exception& err )
23     {
24       error_message += err.what( ) + std::string( "\n" );
25
26     } // yrt
27
28   } // rof
29
30   if( error_message != "" )
31   {
32     std::cerr
33       << "***************************************" << std::endl
34       << "Errors during load: " << std::endl
35       << error_message << std::endl
36       << "***************************************" << std::endl;
37
38   } // fi
39
40   // Show loader information
41   std::cout << "---------------------------" << std::endl;
42   std::cout << loader << std::endl;
43   std::cout << "---------------------------" << std::endl;
44
45   // Close connection to loaded plugins file
46   loader.UnRegisterAll( );
47
48   // Just a last check
49   std::cout << "---------------------------" << std::endl;
50   std::cout << loader << std::endl;
51   std::cout << "---------------------------" << std::endl;
52
53   return( 0 );
54 }
55
56 // eof - $RCSfile$