summaryrefslogtreecommitdiffstats
path: root/tests/hawd/state.cpp
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2014-12-09 22:02:35 +0100
committerAaron Seigo <aseigo@kde.org>2014-12-11 01:01:13 +0100
commita9fb4f869271f47c3a4507d2bc6b8b3d756ec873 (patch)
tree3d4c171a0a9ed85dd01008af388cfe63bcda7538 /tests/hawd/state.cpp
parent02c16b560eb2b1f00c154a945b60478419ecc2eb (diff)
downloadsink-a9fb4f869271f47c3a4507d2bc6b8b3d756ec873.tar.gz
sink-a9fb4f869271f47c3a4507d2bc6b8b3d756ec873.zip
DataSet, and create a small lib to be used by tests
Diffstat (limited to 'tests/hawd/state.cpp')
-rw-r--r--tests/hawd/state.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/hawd/state.cpp b/tests/hawd/state.cpp
index cfc4326..3ee7775 100644
--- a/tests/hawd/state.cpp
+++ b/tests/hawd/state.cpp
@@ -31,22 +31,24 @@ static const QString configFileName("hawd.conf");
31namespace HAWD 31namespace HAWD
32{ 32{
33 33
34State::State() 34State::State(const QString &_configPath)
35 : m_valid(true) 35 : m_valid(true)
36{ 36{
37 QDir dir; 37 QString configPath = _configPath;
38 QString configPath; 38 if (configPath.isEmpty()) {
39 QDir dir;
39 40
40 while (!dir.exists(configFileName) && dir.cdUp()) { } 41 while (!dir.exists(configFileName) && dir.cdUp()) { }
41 42
42 if (dir.exists(configFileName)) { 43 if (dir.exists(configFileName)) {
43 configPath = dir.absoluteFilePath(configFileName); 44 configPath = dir.absoluteFilePath(configFileName);
44 } 45 }
45 46
46 if (configPath.isEmpty()) { 47 if (configPath.isEmpty()) {
47 std::cerr << QObject::tr("Could not find hawd configuration. A hawd.conf file must be in the current directory or in a directory above it.").toStdString() << std::endl; 48 std::cerr << QObject::tr("Could not find hawd configuration. A hawd.conf file must be in the current directory or in a directory above it.").toStdString() << std::endl;
48 m_valid = false; 49 m_valid = false;
49 return; 50 return;
51 }
50 } 52 }
51 53
52 QFile configFile(configPath); 54 QFile configFile(configPath);