comparison ui/tests/cinstprocesstest.cpp @ 294:d95fd88f6616

Prepare cinstprocesstest to be executed on Windows
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 02 Apr 2014 15:41:31 +0000
parents 6a7eb102716d
children 02df89a275a6
comparison
equal deleted inserted replaced
293:3ae8b3ab3eab 294:d95fd88f6616
5 #include <QDebug> 5 #include <QDebug>
6 #include <QDir> 6 #include <QDir>
7 #include <QFile> 7 #include <QFile>
8 #include <QProcess> 8 #include <QProcess>
9 9
10 #define RELATIVE_CINST_PATH "../../cinst/cinst" 10 #define CINST_PATH_CANDIDATES "../../cinst/cinst" << \
11 "cinst" << "../../cinst/cinst.exe" << "cinst.exe";
11 12
12 QProcess *CinstProcessTest::startCinstProcess() { 13 QProcess *CinstProcessTest::startCinstProcess(const QStringList& args) {
14 QStringList cinstCandidates;
15 cinstCandidates << CINST_PATH_CANDIDATES;
16 QString processPath;
17 foreach (const QString& candidate, cinstCandidates) {
18 QFileInfo fi(candidate);
19 if (fi.isExecutable()) {
20 processPath = candidate;
21 break;
22 }
23 }
24
13 QProcess *installerProcess = new QProcess(); 25 QProcess *installerProcess = new QProcess();
14 installerProcess->setProgram(RELATIVE_CINST_PATH); 26 installerProcess->setArguments(args);
27 installerProcess->setProgram(processPath);
15 installerProcess->start(); 28 installerProcess->start();
16 installerProcess->waitForStarted(); 29 installerProcess->waitForStarted();
17 return installerProcess; 30 return installerProcess;
18 } 31 }
19 32

http://wald.intevation.org/projects/trustbridge/