Skip to content

Commit a8e8f4d

Browse files
committed
Fixed tests to search for plugin in homebrew install dir
1 parent 1b1855e commit a8e8f4d

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

test-shared/main.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
#include <QCoreApplication>
22
#include <QtSql>
33
#include <QTemporaryDir>
4+
5+
#include <QDirIterator>
6+
#include <QStringList>
7+
48
#include <iostream>
59
#include <cstdlib>
610

711
#define QSQLCIPHER_TEST_ASSERT(cond, message) if(!(cond)) { std::cerr << message << std::endl; exit(-1); }
812

9-
int main(int argc, char *argv[])
10-
{
13+
int main(int argc, char *argv[]) {
14+
15+
// Check for MacOSX Plugin directories
16+
QDirIterator pluginDirIt("/usr/local/Cellar/qt5-sqlcipher");
17+
QStringList pluginVersions;
18+
while (pluginDirIt.hasNext()) {
19+
QString const pluginDir = pluginDirIt.next();
20+
QString const fileName(pluginDirIt.fileName());
21+
if ((fileName.compare(QStringLiteral(".")) == 0) || (fileName.compare(QStringLiteral("..")) == 0)) {
22+
continue;
23+
}
24+
pluginVersions.append(pluginDir);
25+
}
26+
pluginVersions.sort();
27+
if (!pluginVersions.isEmpty()) {
28+
QCoreApplication::addLibraryPath(pluginVersions.last());
29+
}
30+
1131
QCoreApplication app(argc, argv);
1232

1333
for (const auto& driver : QSqlDatabase::drivers()) {

0 commit comments

Comments
 (0)