Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qcoreapplication_mac.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include "private/qcoreapplication_p.h"
6#include <private/qcore_mac_p.h>
7
9
10/*****************************************************************************
11 QCoreApplication utility functions
12 *****************************************************************************/
13QString qAppFileName()
14{
15 // QCoreApplication::applicationFilePath() expects a canonical path
16 static QString appFileName;
17 if (appFileName.isEmpty()) {
18 QCFType<CFURLRef> bundleURL(CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
19 if (bundleURL) {
20 QCFString cfPath(CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle));
21 if (cfPath)
22 appFileName = cfPath;
23 }
24 }
25 return appFileName;
26}
27
28QT_END_NAMESPACE