summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-02-17 13:52:48 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-02-18 17:21:05 +0000
commit783930c2fc0a82da47664d12b03375ff3de91a53 (patch)
treee367258b9336e14b761498658f0e2917660c7dbc
parentdb544a5e7bc5a3e3730778aceae8882f6b89d059 (diff)
downloadqtdoc-783930c2fc0a82da47664d12b03375ff3de91a53.tar.gz
macOS: Update example of how to retrieve the application bundle path
Fixes: QTBUG-110742 Change-Id: Ic81ea40caf9fe6b261f2536f11fa2b460b416aaa Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 2fd50c4903ea8a14bd1fc72874ec6a01dbce25f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--doc/src/platforms/macos.qdoc8
-rw-r--r--doc/src/snippets/code/doc_src_mac-differences.cpp10
2 files changed, 4 insertions, 14 deletions
diff --git a/doc/src/platforms/macos.qdoc b/doc/src/platforms/macos.qdoc
index 3592f74e..cfe6c10c 100644
--- a/doc/src/platforms/macos.qdoc
+++ b/doc/src/platforms/macos.qdoc
@@ -590,12 +590,8 @@
\snippet snippets/code/doc_src_mac-differences.cpp 1
- \note When \macos is set to use Japanese, a bug causes this sequence
- to fail and return an empty string. Therefore, always test the
- returned string.
-
- For more information about using the CFBundle API, visit
- \l{http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/index.html}
+ For more information about using the NSBundle API, visit
+ \l{https://developer.apple.com/documentation/foundation/nsbundle?language=objc}
{Apple's Developer Website}.
QCoreApplication::applicationDirPath() can be used to determine
diff --git a/doc/src/snippets/code/doc_src_mac-differences.cpp b/doc/src/snippets/code/doc_src_mac-differences.cpp
index 334f21f9..97646f77 100644
--- a/doc/src/snippets/code/doc_src_mac-differences.cpp
+++ b/doc/src/snippets/code/doc_src_mac-differences.cpp
@@ -3,13 +3,7 @@
//! [1]
#ifdef Q_OS_MAC
- CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
- CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef,
- kCFURLPOSIXPathStyle);
- const char *pathPtr = CFStringGetCStringPtr(macPath,
- CFStringGetSystemEncoding());
- qDebug("Path = %s", pathPtr);
- CFRelease(appUrlRef);
- CFRelease(macPath);
+ QString bundlePath = QString::fromNSString(NSBundle.mainBundle.bundlePath);
+ qDebug() << "Bundle path =" << bundlePath;
#endif
//! [1]