Navigation Menu

Skip to content

Commit

Permalink
Use env var for library paths.
Browse files Browse the repository at this point in the history
This fixes sensorfwd when used in a confinement environment.
  • Loading branch information
Lorn Potter committed Nov 11, 2016
1 parent fa6681b commit a10df5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion core/loader.cpp
Expand Up @@ -54,7 +54,13 @@ bool Loader::loadPluginFile(const QString& name, QString *errorString, QStringLi
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QString pluginPath = QString::fromLatin1("/usr/lib/sensord/lib%1.so").arg(name);
#else
QString pluginPath = QString::fromLatin1("/usr/lib/sensord-qt5/lib%1-qt5.so").arg(name);
QString pluginPath;
QByteArray env = qgetenv("SENSORFW_LIBRARY_PATH");
if (env.isEmpty())
pluginPath = QString::fromLatin1("/usr/lib/sensord-qt5/lib%1-qt5.so").arg(name);
else
pluginPath = QString::fromLatin1(env+"/usr/lib/sensord-qt5/lib%1-qt5.so").arg(name);

#endif

QPluginLoader qpl(pluginPath);
Expand Down
8 changes: 7 additions & 1 deletion core/sensormanager.cpp
Expand Up @@ -108,7 +108,13 @@ SensorManager::SensorManager()
pipeNotifier_(0),
deviation(0)
{
const char* SOCKET_NAME = "/var/run/sensord.sock";
QString pluginPath;
QByteArray env = qgetenv("SENSORFW_LIBRARY_PATH");
const char* SOCKET_NAME;
if (env.isEmpty())
SOCKET_NAME = "/var/run/sensord.sock";
else
SOCKET_NAME = env+"/var/run/sensord.sock";

new SensorManagerAdaptor(this);

Expand Down

0 comments on commit a10df5b

Please sign in to comment.