18#ifndef QT_NO_STANDARDPATHS
43#ifndef QT_BOOTSTRAPPED
49 path += u
'/' + appName;
66 QVarLengthArray<char,256> token_info_buf(256);
67 auto* token_info =
reinterpret_cast<TOKEN_MANDATORY_LABEL*
>(token_info_buf.data());
68 DWORD token_info_length = token_info_buf.size();
69 if (!GetTokenInformation(process_token, TokenIntegrityLevel, token_info, token_info_length, &token_info_length)) {
71 token_info_buf.resize(token_info_length);
72 token_info =
reinterpret_cast<TOKEN_MANDATORY_LABEL*
>(token_info_buf.data());
73 if (!GetTokenInformation(process_token, TokenIntegrityLevel, token_info, token_info_length, &token_info_length))
79 DWORD integrity_level = *GetSidSubAuthority(token_info->Label.Sid, *GetSidSubAuthorityCount(token_info->Label.Sid) - 1);
80 return (integrity_level < SECURITY_MANDATORY_MEDIUM_RID);
87 static const GUID folderIds[] = {
96 FOLDERID_LocalAppData,
98 FOLDERID_LocalAppData,
100 FOLDERID_LocalAppData,
103 FOLDERID_LocalAppData,
104 FOLDERID_RoamingAppData,
105 FOLDERID_LocalAppData,
114 static const GUID folderIds_li[] = {
123 FOLDERID_LocalAppDataLow,
125 FOLDERID_LocalAppDataLow,
127 FOLDERID_LocalAppDataLow,
130 FOLDERID_LocalAppDataLow,
131 FOLDERID_RoamingAppData,
132 FOLDERID_LocalAppDataLow,
138 static_assert(
sizeof(folderIds_li) ==
sizeof(folderIds));
141 if (
size_t(
type) <
sizeof(folderIds) /
sizeof(folderIds[0]))
142 return low_integrity_process ? folderIds_li[
type] : folderIds[
type];
151 if (
Q_LIKELY(SUCCEEDED(SHGetKnownFolderPath(clsid, KF_FLAG_DONT_VERIFY, 0, &
path)))) {
220#ifndef QT_BOOTSTRAPPED
228 if (!localDir.isEmpty())
229 dirs.append(localDir);
234 if (!programData.isEmpty()) {
237 dirs.append(programData);
239#ifndef QT_BOOTSTRAPPED
245 dirs.append(applicationDirPath);
246 const QString dataDir = applicationDirPath +
"/data"_L1;
252 if (appDataDir != dataDir)
253 dirs.append(appDataDir);
QString organizationName
the name of the organization that wrote this application
static QString applicationDirPath()
Returns the directory that contains the application executable.
QString applicationName
the name of this application
static QString fromNativeSeparators(const QString &pathName)
static QString tempPath()
Returns the absolute canonical path of the system's temporary directory.
static QString homePath()
Returns the absolute path of the user's home directory.
static bool isTestModeEnabled()
static QStringList standardLocations(StandardLocation type)
static QString writableLocation(StandardLocation type)
StandardLocation
This enum describes the different locations that can be queried using methods such as QStandardPaths:...
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
QString & append(QChar c)
Combined button and popup list for selecting options.
GLsizei const GLchar *const * path
static void appendOrganizationAndApp(QString &path)
static GUID writableSpecialFolderId(QStandardPaths::StandardLocation type)
static bool isGenericConfigLocation(QStandardPaths::StandardLocation type)
static bool isProcessLowIntegrity()
static void appendTestMode(QString &path)
static void appendOrganizationAndApp(QString &path)
static bool isConfigLocation(QStandardPaths::StandardLocation type)
static QString sHGetKnownFolderPath(const GUID &clsid)
static QString convertCharArray(const wchar_t *path)