summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2012-04-12 10:41:55 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-12 03:23:45 +0200
commitcf9442c184f1cd4b3e8baba517fc757085cd5ea5 (patch)
tree95c1c6db3444170284591f1e2eef7df32c0316a8 /src
parentfbbd77647d0e9ab764b21203b8ad7de91dc57e02 (diff)
Allow setting the config file location explicitly.
This is a workaround for platforms where QStandardPaths is either broken or returning paths that aren't useful. Change-Id: I4f7fbb0ea068d0bf13dc4f572ddbd25ad6048053 Reviewed-by: Zsolt Simon <zsolt.simon@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/sensors/qsensormanager.cpp10
-rw-r--r--src/sensors/sensors.pro1
2 files changed, 7 insertions, 4 deletions
diff --git a/src/sensors/qsensormanager.cpp b/src/sensors/qsensormanager.cpp
index 351900c4..92c49009 100644
--- a/src/sensors/qsensormanager.cpp
+++ b/src/sensors/qsensormanager.cpp
@@ -92,13 +92,15 @@ public:
void readConfigFile()
{
defaultIdentifierForTypeLoaded = true;
+#ifdef QTSENSORS_CONFIG_PATH
+ QString config = QString::fromLocal8Bit(QTSENSORS_CONFIG_PATH);
+#else
QStringList configs = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);
- // This list shouldn't be empty... but sometimes it is!
- if (configs.count() == 0) configs << QString();
+ if (configs.count() == 0) return; // QStandardPaths is broken?
QString config = configs.at(configs.count()-1);
- // This variable shouldn't be empty... but sometimes it is!
- if (config.isEmpty()) config = QLatin1String("/etc/xdg");
+ if (config.isEmpty()) return; // QStandardPaths is broken?
config += QLatin1String("/Nokia/Sensors.conf");
+#endif
if (!QFile::exists(config)) return;
QFile cfgfile(config);
if (!cfgfile.open(QFile::ReadOnly)) return;
diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro
index d5b6b796..dc5f8db9 100644
--- a/src/sensors/sensors.pro
+++ b/src/sensors/sensors.pro
@@ -12,6 +12,7 @@ MODULE_PRI = ../../modules/qt_sensors.pri
QT = core core-private
DEFINES += QT_BUILD_SENSORS_LIB QT_MAKEDLL
+!isEmpty(SENSORS_CONFIG_PATH):DEFINES += "QTSENSORS_CONFIG_PATH=\\\"$$SENSORS_CONFIG_PATH\\\""
load(qt_module_config)
HEADERS += qtsensorsversion.h