output metadata about the searched plugin directories if a plugin cannot be found - closes #568

This commit is contained in:
Dane Springmeyer 2010-07-15 21:13:03 +00:00
parent fd4ff876b6
commit 37df6ba211
2 changed files with 10 additions and 1 deletions

View file

@ -48,8 +48,10 @@ namespace mapnik {
static std::map<std::string,boost::shared_ptr<PluginInfo> > plugins_;
static bool registered_;
static bool insert(const std::string& name,const lt_dlhandle module);
static std::vector<std::string> plugin_directories_;
public:
static std::vector<std::string> plugin_names ();
static std::string plugin_directories();
static void register_datasources(const std::string& path);
static boost::shared_ptr<datasource> create(parameters const& params);
};

View file

@ -61,6 +61,7 @@ namespace mapnik
std::map<string,boost::shared_ptr<PluginInfo> > datasource_cache::plugins_;
bool datasource_cache::registered_=false;
std::vector<std::string> datasource_cache::plugin_directories_;
datasource_ptr datasource_cache::create(const parameters& params)
{
@ -76,7 +77,7 @@ namespace mapnik
if ( itr == plugins_.end() )
{
throw config_error(string("Could not create datasource. No plugin ") +
"found for type '" + * type + "'");
"found for type '" + * type + "' (searched in: " + plugin_directories() + ")");
}
if ( ! itr->second->handle())
{
@ -114,6 +115,11 @@ namespace mapnik
(new PluginInfo(type,module)))).second;
}
std::string datasource_cache::plugin_directories()
{
return boost::algorithm::join(plugin_directories_,", ");
}
std::vector<std::string> datasource_cache::plugin_names ()
{
std::vector<std::string> names;
@ -132,6 +138,7 @@ namespace mapnik
mapnik::CreateStatic>::mutex_);
#endif
filesystem::path path(str);
plugin_directories_.push_back(str);
filesystem::directory_iterator end_itr;