mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 01:26:30 +00:00
Fixed: OVQT plugins loading under Unices (in the order: local, OVQT plugins, system)
This commit is contained in:
parent
dd64516b58
commit
5b6e448bde
2 changed files with 43 additions and 4 deletions
|
@ -13,7 +13,7 @@ ELSEIF(APPLE)
|
|||
SET(OVQT_PLUGIN_DIR "plugins")
|
||||
ELSE(WIN32)
|
||||
SET(OVQT_PLUGIN_DIR ${NL_SHARE_PREFIX}/object_viewer_qt/plugins)
|
||||
ADD_DEFINITIONS(-DDATA_DIR="\\"${NL_SHARE_ABSOLUTE_PREFIX}/object_viewer_qt/\\"")
|
||||
ADD_DEFINITIONS(-DDATA_DIR="\\"${NL_SHARE_ABSOLUTE_PREFIX}/object_viewer_qt\\"" -DPLUGINS_DIR="\\"${NL_LIB_ABSOLUTE_PREFIX}/object_viewer_qt\\"")
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(UNIX AND WITH_STATIC)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue