Enhanced error reporting for plugin loading

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@1876 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2004-08-16 18:31:49 +00:00
parent f42b0ef833
commit 051b79a728
2 changed files with 26 additions and 8 deletions

View File

@ -550,7 +550,7 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
{
QString myFullPath = thePluginDirString + "/" + myPluginDir[i];
#ifdef QGISDEBUG
std::cerr << "Examining " << myFullPath << std::endl;
std::cerr << "Examining " << myFullPath.ascii() << std::endl;
#endif
QLibrary *myLib = new QLibrary(myFullPath);
bool loaded = myLib->load();
@ -571,7 +571,7 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
if (mySettings.readBoolEntry("/qgis/Plugins/" + myEntryName))
{
#ifdef QGISDEBUG
std::cerr << " -------------------- loading " << myEntryName << std::endl;
std::cerr << " -------------------- loading " << myEntryName.ascii() << std::endl;
#endif
loadPlugin(myName(), myDescription(), myFullPath);
}
@ -579,13 +579,13 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
else
{
#ifdef QGISDEBUG
std::cerr << "Failed to get name, description, or type for " << myLib->library() << std::endl;
std::cerr << "Failed to get name, description, or type for " << myLib->library().ascii() << std::endl;
#endif
}
}
else
{
std::cerr << "Failed to load " << myLib->library() << std::endl;
std::cerr << "Failed to load " << myLib->library().ascii() << std::endl;
}
}
}

View File

@ -98,15 +98,33 @@ sharedLibExtension = "*.so*";
#endif //#ifdef TESTLIB
std::cout << "Examining " << txtPluginDir->text() << "/" << pluginDir[i] << std::endl;
std::cout << "Examining " << txtPluginDir->text().ascii() << "/" << pluginDir[i].ascii() << std::endl;
QLibrary *myLib = new QLibrary(txtPluginDir->text() + "/" + pluginDir[i]);
bool loaded = myLib->load();
if (loaded)
{
std::cout << "Loaded " << myLib->library() << std::endl;
std::cout << "Loaded " << myLib->library().ascii() << std::endl;
name_t *pName = (name_t *) myLib->resolve("name");
description_t *pDesc = (description_t *) myLib->resolve("description");
version_t *pVersion = (version_t *) myLib->resolve("version");
#ifdef QGISDEBUG
// show the values (or lack of) for each function
if(pName){
std::cout << "Plugin name: " << pName().ascii() << std::endl;
}else{
std::cout << "Plugin name not returned when queried\n";
}
if(pDesc){
std::cout << "Plugin description: " << pDesc().ascii() << std::endl;
}else{
std::cout << "Plugin description not returned when queried\n";
}
if(pVersion){
std::cout << "Plugin version: " << pVersion().ascii() << std::endl;
}else{
std::cout << "Plugin version not returned when queried\n";
}
#endif
if (pName && pDesc && pVersion)
{
QCheckListItem *pl = new QCheckListItem(lstPlugins, pName(), QCheckListItem::CheckBox); //, pDesc(), pluginDir[i])
@ -137,11 +155,11 @@ sharedLibExtension = "*.so*";
}
} else
{
std::cout << "Failed to get name, description, or type for " << myLib->library() << std::endl;
std::cout << "Failed to get name, description, or type for " << myLib->library().ascii() << std::endl;
}
} else
{
std::cout << "Failed to load " << myLib->library() << std::endl;
std::cout << "Failed to load " << myLib->library().ascii() << std::endl;
}
}
}