aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <[email protected]>2017-06-22 21:59:16 +0200
committerDaniel Vrátil <[email protected]>2017-06-22 21:59:16 +0200
commitda912d868bbcf6d6e3c4acdc515b58c39abe9dcb (patch)
treee5cd3783cec930bed8ddf063f68528619d0bce16
parent679a33e2eb31f8ad64ac492cbab4b0255698ec6e (diff)
Fix build on Windows
Untested, but should work.
-rw-r--r--src/common.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/common.h b/src/common.h
index 2e556bf..15d60f3 100644
--- a/src/common.h
+++ b/src/common.h
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <QFile>
#include <QDir>
+#include <QCoreApplication>
extern "C" {
#include <sasl/sasl.h>
@@ -30,13 +31,17 @@ extern "C" {
inline bool initSASL()
{
-#ifdef Q_OS_WIN32 //krazy:exclude=cpp
- QByteArray libInstallPath(QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("lib") + QLatin1String("sasl2"))));
- QByteArray configPath(QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("config") + QLatin1String("sasl2"))));
- if (sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK ||
- sasl_set_path(SASL_PATH_TYPE_CONFIG, configPath.data()) != SASL_OK) {
- fprintf(stderr, "SASL path initialization failed!\n");
- return false;
+#ifdef Q_OS_WIN //krazy:exclude=cpp
+ for (const auto &path : QCoreApplication::libraryPaths()) {
+ QDir dir(path);
+ if (dir.exists(QStringLiteral("sasl2"))) {
+ auto libInstallPath = QFile::encodeName(dir.absoluteFilePath(QStringLiteral("sasl2")));
+ if (sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK) {
+ fprintf(stderr, "SASL path initialization failed!\n");
+ return false;
+ }
+ break;
+ }
}
#endif