Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:rhabacker:branches:windows:mingw:win32:Qt515
mingw32-libqt5-qtbase
add-support-for-qt.conf-at-dll-location.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File add-support-for-qt.conf-at-dll-location.patch of Package mingw32-libqt5-qtbase
--- a/src/corelib/global/qlibraryinfo.cpp 2018-07-27 13:16:57.498550219 +0000 +++ b/src/corelib/global/qlibraryinfo.cpp 2018-07-27 13:27:08.126587545 +0000 @@ -169,6 +169,34 @@ } } +#ifdef Q_OS_WIN +#include <windows.h> + +QString findMe() +{ + WCHAR path[MAX_PATH]; + HMODULE handle; + if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + reinterpret_cast<LPWSTR>(&findMe), &handle)) { + GetModuleFileNameW(handle, path, sizeof(path)); + return QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const ushort*>(path))); + } + return QString(); +} +#endif + +QSettings *findQtConf(const QString &path) +{ + QDir pwd(path); + QString qtconfig = pwd.filePath(QLatin1String("qt5.conf")); + if (QFile::exists(qtconfig)) + return new QSettings(qtconfig, QSettings::IniFormat); + qtconfig = pwd.filePath(QLatin1String("qt.conf")); + if (QFile::exists(qtconfig)) + return new QSettings(qtconfig, QSettings::IniFormat); + return nullptr; +} + QSettings *QLibraryInfoPrivate::findConfiguration() { #ifdef QT_BUILD_QMAKE @@ -195,13 +223,15 @@ } #endif if (QCoreApplication::instance()) { - QDir pwd(QCoreApplication::applicationDirPath()); - qtconfig = pwd.filePath(QLatin1String("qt5.conf")); - if (QFile::exists(qtconfig)) - return new QSettings(qtconfig, QSettings::IniFormat); - qtconfig = pwd.filePath(QLatin1String("qt.conf")); - if (QFile::exists(qtconfig)) - return new QSettings(qtconfig, QSettings::IniFormat); + QSettings *settings = findQtConf(QCoreApplication::applicationDirPath()); + if (settings) + return settings; +#ifdef Q_OS_WIN + QFileInfo fi(findMe()); + settings = findQtConf(fi.absolutePath()); + if (settings) + return settings; +#endif } #endif return 0; //no luck
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor