|
|
|
@ -31,6 +31,10 @@
|
|
|
|
|
#include <QtCore/QPluginLoader>
|
|
|
|
|
#include <QtCore/QCoreApplication>
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
namespace ExtensionSystem
|
|
|
|
|
{
|
|
|
|
|
const char *const PLUGIN_SPEC_NAME = "name";
|
|
|
|
@ -143,9 +147,44 @@ bool PluginSpec::setFileName(const QString &fileName)
|
|
|
|
|
m_fileName = m_prefix + fileName + m_suffix;
|
|
|
|
|
m_filePath = m_location + "/" + m_fileName;
|
|
|
|
|
|
|
|
|
|
QFile file;
|
|
|
|
|
file.setFileName(m_filePath);
|
|
|
|
|
|
|
|
|
|
bool exists = file.exists();
|
|
|
|
|
|
|
|
|
|
#ifdef NL_OS_UNIX
|
|
|
|
|
|
|
|
|
|
#ifdef PLUGINS_DIR
|
|
|
|
|
if (!exists)
|
|
|
|
|
{
|
|
|
|
|
// if plugin can't be found in the same directory as spec file,
|
|
|
|
|
// looks for it in PLUGINS_DIR
|
|
|
|
|
m_filePath = QString("%1/%2").arg(PLUGINS_DIR).arg(m_fileName);
|
|
|
|
|
|
|
|
|
|
file.setFileName(m_filePath);
|
|
|
|
|
|
|
|
|
|
exists = file.exists();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef NL_LIB_PREFIX
|
|
|
|
|
if (!exists)
|
|
|
|
|
{
|
|
|
|
|
// if plugin can't be found in the same directory as spec file or PLUGINS_DIR,
|
|
|
|
|
// looks for it in NL_LIB_PREFIX
|
|
|
|
|
m_filePath = QString("%1/%2").arg(NL_LIB_PREFIX).arg(m_fileName);
|
|
|
|
|
|
|
|
|
|
file.setFileName(m_filePath);
|
|
|
|
|
|
|
|
|
|
exists = file.exists();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
nlinfo(m_filePath.toStdString().c_str());
|
|
|
|
|
QFile file(m_filePath);
|
|
|
|
|
if (!file.exists())
|
|
|
|
|
|
|
|
|
|
if (!exists)
|
|
|
|
|
return reportError(QCoreApplication::translate("PluginSpec", "File does not exist: %1").arg(file.fileName()));
|
|
|
|
|
if (!file.open(QIODevice::ReadOnly))
|
|
|
|
|
return reportError(QCoreApplication::translate("PluginSpec", "Could not open file for read: %1").arg(file.fileName()));
|
|
|
|
@ -391,4 +430,4 @@ bool PluginSpec::reportError(const QString &err)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace ExtensionSystem
|
|
|
|
|
} // namespace ExtensionSystem
|
|
|
|
|