summaryrefslogtreecommitdiffstats
path: root/synchronizer/main.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-23 14:43:26 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-23 14:43:26 +0200
commitc9f26c4cbca654417d304c9214aa3a7709631159 (patch)
treefd19cab23dbea2364f6c381d67d68fdd943f63a2 /synchronizer/main.cpp
parent422950c63f830e4d01315afc37d0144f79bf10db (diff)
downloadsink-c9f26c4cbca654417d304c9214aa3a7709631159.tar.gz
sink-c9f26c4cbca654417d304c9214aa3a7709631159.zip
Propagate test-mode to resources.
This way we can run tests in completely separate data-directories.
Diffstat (limited to 'synchronizer/main.cpp')
-rw-r--r--synchronizer/main.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/synchronizer/main.cpp b/synchronizer/main.cpp
index e000e03..8335e67 100644
--- a/synchronizer/main.cpp
+++ b/synchronizer/main.cpp
@@ -28,6 +28,7 @@
28 28
29#include "listener.h" 29#include "listener.h"
30#include "log.h" 30#include "log.h"
31#include "test.h"
31 32
32#undef DEBUG_AREA 33#undef DEBUG_AREA
33#define DEBUG_AREA "resource" 34#define DEBUG_AREA "resource"
@@ -123,13 +124,23 @@ int main(int argc, char *argv[])
123 124
124 QCoreApplication app(argc, argv); 125 QCoreApplication app(argc, argv);
125 126
126 if (argc < 3) { 127 QByteArrayList arguments;
128 for (int i = 0; i < argc; i++) {
129 arguments << argv[i];
130 }
131 if (arguments.contains("--test")) {
132 Log() << "Running in test-mode";
133 arguments.removeAll("--test");
134 Sink::Test::setTestModeEnabled(true);
135 }
136
137 if (arguments.count() < 3) {
127 Warning() << "Not enough args passed, no resource loaded."; 138 Warning() << "Not enough args passed, no resource loaded.";
128 return app.exec(); 139 return app.exec();
129 } 140 }
130 141
131 const QByteArray instanceIdentifier = argv[1]; 142 const QByteArray instanceIdentifier = arguments.at(1);
132 const QByteArray resourceType = argv[2]; 143 const QByteArray resourceType = arguments.at(2);
133 app.setApplicationName(instanceIdentifier); 144 app.setApplicationName(instanceIdentifier);
134 145
135 QLockFile lockfile(instanceIdentifier + ".lock"); 146 QLockFile lockfile(instanceIdentifier + ".lock");