Commit 83fb0a01 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make working on windows too

parent 37ef3707
Pipeline #20813 passed with stage
in 13 minutes and 23 seconds
......@@ -24,14 +24,35 @@
void CompareFileHelper::compareFile(const QString &referenceFile, const QString &archiveFile)
{
//qDebug() << "referenceFile " << referenceFile << " archiveFile " << archiveFile;
QProcess proc;
const QStringList args = QStringList()
<< QStringLiteral("-u")
<< referenceFile
<< archiveFile;
//qDebug() << "referenceFile " << referenceFile << " archiveFile " << archiveFile;
#ifdef _WIN32
QStringList args = QStringList()
<< QStringLiteral("Compare-Object")
<< QString(QStringLiteral("(Get-Content %1)")).arg(referenceFile)
<< QString(QStringLiteral("(Get-Content %1)")).arg(archiveFile);
proc.start(QStringLiteral("powershell"), args);
QVERIFY(proc.waitForFinished());
auto pStdOut = proc.readAllStandardOutput();
if (pStdOut.size()) {
qDebug() << "Files are different, diff output message:\n"
<< pStdOut.toStdString().c_str();
}
QCOMPARE(pStdOut.size(), 0);
#else
// compare to reference file
QStringList args = QStringList()
<< QStringLiteral("-u")
<< referenceFile
<< archiveFile;
proc.setProcessChannelMode(QProcess::ForwardedChannels);
proc.start(QStringLiteral("diff"), args);
QVERIFY(proc.waitForFinished());
QCOMPARE(proc.exitCode(), 0);
#endif
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment