From 0ff5c8a62700891de08e3fd5baef2aa85f795221 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Fri, 11 Mar 2011 15:38:03 +0000 Subject: [PATCH] added check for existence of the xml file --- src/common/pluginmanager.cpp | 41 +++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/common/pluginmanager.cpp b/src/common/pluginmanager.cpp index 653f08c08..b837852a6 100644 --- a/src/common/pluginmanager.cpp +++ b/src/common/pluginmanager.cpp @@ -60,25 +60,32 @@ void PluginManager::loadPlugins(RichParameterSet& defaultGlobal) QString withoutext = fileName.left(res); QString xmlFile = getPluginDirPath() + "/" + withoutext + QObject::tr(".xml"); qDebug("Loading XMLFile: %s",qPrintable(xmlFile)); - XMLMessageHandler xmlErr; - fc.xmlInfo = XMLFilterInfo::createXMLFileInfo(xmlFile,xmlSchemaFile(),xmlErr); - if (fc.xmlInfo != NULL) - { - QStringList fn = fc.xmlInfo->filterNames(); - foreach(QString filtName,fn) - { - fc.act = new QAction(filtName,plugin); - stringXMLFilterMap.insert(filtName,fc); + if(!QFileInfo(xmlFile).exists()) + { + qDebug("Error XMLFile: %s does not exist",qPrintable(xmlFile)); + } + else + { + XMLMessageHandler xmlErr; + fc.xmlInfo = XMLFilterInfo::createXMLFileInfo(xmlFile,xmlSchemaFile(),xmlErr); + if (fc.xmlInfo != NULL) + { + QStringList fn = fc.xmlInfo->filterNames(); + foreach(QString filtName,fn) + { + fc.act = new QAction(filtName,plugin); + stringXMLFilterMap.insert(filtName,fc); - //SHOULD INITIALIZE GLOBALS FOR FILTERS + //SHOULD INITIALIZE GLOBALS FOR FILTERS - } - } - else - { - QString err = xmlErr.statusMessage(); - qDebug("Error in XMLFile: %s - line: %d, column: %d - %s",qPrintable(xmlFile),xmlErr.line(),xmlErr.column(),qPrintable(err)); - } + } + } + else + { + QString err = xmlErr.statusMessage(); + qDebug("Error in XMLFile: %s - line: %d, column: %d - %s",qPrintable(xmlFile),xmlErr.line(),xmlErr.column(),qPrintable(err)); + } + } } MeshIOInterface *iIO = qobject_cast(plugin);