diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-28 01:00:09 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-01-28 08:09:51 +0100 |
commit | 082faeff9c4c5a5b10d140b391d30305575a898b (patch) | |
tree | 505d176f243bfa3785a8aeb13138d3eba476175b /src/corelib/global/qlibraryinfo.cpp | |
parent | be8c257da9a264994243c120231965ff0008ef09 (diff) | |
parent | 1ed802e3b8a7f236bd277719090f461a87eae78e (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
src/gui/image/qpnghandler.cpp
Change-Id: I8630f363457bb613d8fb88470a71d95d97cdb301
Diffstat (limited to 'src/corelib/global/qlibraryinfo.cpp')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index fa2098c757..835fea0c77 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -535,8 +535,25 @@ static QString getRelocatablePrefix() #if defined(QT_STATIC) prefixPath = prefixFromAppDirHelper(); #elif defined(Q_OS_DARWIN) && QT_CONFIG(framework) - CFBundleRef qtCoreBundle = CFBundleGetBundleWithIdentifier( - CFSTR("org.qt-project.QtCore")); + auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore")); + if (!qtCoreBundle) { + // When running Qt apps over Samba shares, CoreFoundation will fail to find + // the Resources directory inside the bundle, This directory is a symlink, + // and CF relies on readdir() and dtent.dt_type to detect symlinks, which + // does not work reliably for Samba shares. We work around it by manually + // looking for the QtCore bundle. + auto allBundles = CFBundleGetAllBundles(); + auto bundleCount = CFArrayGetCount(allBundles); + for (int i = 0; i < bundleCount; ++i) { + auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i)); + auto url = QCFType<CFURLRef>(CFBundleCopyBundleURL(bundle)); + auto path = QCFType<CFStringRef>(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle)); + if (CFStringHasSuffix(path, CFSTR("/QtCore.framework"))) { + qtCoreBundle = bundle; + break; + } + } + } Q_ASSERT(qtCoreBundle); QCFType<CFURLRef> qtCorePath = CFBundleCopyBundleURL(qtCoreBundle); |