Also drop hardcoded NYMEA_PLUGINS_PATH from .pro file

pull/153/head
Michael Zanetti 2019-04-16 23:29:58 +02:00
parent 366c2e515b
commit ad4c2acbfc
5 changed files with 7 additions and 18 deletions

View File

@ -245,14 +245,13 @@ QStringList DeviceManager::pluginSearchDirs()
if (!envPath.isEmpty()) {
searchDirs << QString(envPath).split(':');
}
foreach (QString libraryPath, QCoreApplication::libraryPaths()) {
searchDirs << libraryPath.replace("qt5", "nymea");
}
searchDirs << QCoreApplication::applicationDirPath() + "/../lib/nymea/plugins";
searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/";
searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/";
searchDirs << QString("%1").arg(NYMEA_PLUGINS_PATH);
QString snapDir = QString::fromUtf8(qgetenv("SNAP"));
if (!snapDir.isEmpty()) {
searchDirs << QString("%1%2").arg(snapDir).arg(NYMEA_PLUGINS_PATH);
}
return searchDirs;
}

View File

@ -85,12 +85,7 @@ void Translator::loadTranslator(DevicePlugin *plugin, const QLocale &locale)
} else {
QString pluginId = plugin->pluginId().toString().remove(QRegExp("[{}]"));
QStringList searchDirs = QString(qgetenv("NYMEA_PLUGINS_PATH")).split(':');
searchDirs << QCoreApplication::applicationDirPath() + "/../lib/nymea/plugins";
searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/";
searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/";
foreach (const QString &pluginPath, searchDirs) {
foreach (const QString &pluginPath, m_deviceManager->pluginSearchDirs()) {
if (translator->load(locale, pluginId, "-", QDir(pluginPath + "/translations/").absolutePath(), ".qm")) {
qCDebug(dcTranslations()) << "* Loaded translation" << locale.name() << "for plugin" << plugin->pluginName() << "from" << QDir(pluginPath + "/translations/").absolutePath();
loaded = true;

View File

@ -1,9 +1,6 @@
# Parse and export NYMEA_VERSION_STRING
NYMEA_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"')
# Install path for plugins
NYMEA_PLUGINS_PATH=/usr/lib/nymea/plugins/
# define protocol versions
JSON_PROTOCOL_VERSION_MAJOR=2
JSON_PROTOCOL_VERSION_MINOR=0
@ -15,8 +12,7 @@ COPYRIGHT_YEAR_TO=2019
DEFINES += NYMEA_VERSION_STRING=\\\"$${NYMEA_VERSION_STRING}\\\" \
JSON_PROTOCOL_VERSION=\\\"$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}\\\" \
REST_API_VERSION=\\\"$${REST_API_VERSION}\\\" \
COPYRIGHT_YEAR_STRING=\\\"$${COPYRIGHT_YEAR_FROM}-$${COPYRIGHT_YEAR_TO}\\\" \
NYMEA_PLUGINS_PATH=\\\"$${NYMEA_PLUGINS_PATH}\\\"
COPYRIGHT_YEAR_STRING=\\\"$${COPYRIGHT_YEAR_FROM}-$${COPYRIGHT_YEAR_TO}\\\"
QT *= network websockets bluetooth dbus

View File

@ -58,7 +58,6 @@ message("Copyright $${COPYRIGHT_YEAR_FROM} - $${COPYRIGHT_YEAR_TO}")
message("Building nymea version $${NYMEA_VERSION_STRING}")
message("JSON-RPC API version $${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}")
message("REST API version $${REST_API_VERSION}")
message("Plugin path $${NYMEA_PLUGINS_PATH}")
message("Source directory: $${top_srcdir}")
message("Build directory: $${top_builddir}")
message("Translations: $${TRANSLATIONS}")

View File

@ -34,5 +34,5 @@ PRE_TARGETDEPS += compiler_plugininfo_make_all compiler_externplugininfo_make_al
QMAKE_EXTRA_COMPILERS += plugininfo externplugininfo
# Install plugin
target.path = $$NYMEA_PLUGINS_PATH
target.path = /usr/lib/nymea/plugins/
INSTALLS += target