10#if QT_CONFIG(regularexpression)
13#include <private/qfilesystemengine_p.h>
17#ifndef QT_BOOTSTRAPPED
21#ifndef QT_NO_STANDARDPATHS
29#ifndef QT_BOOTSTRAPPED
35 path += u
'/' + appName;
41#if QT_CONFIG(regularexpression)
48 return "DOCUMENTS"_L1;
58 return "PUBLICSHARE"_L1;
60 return "TEMPLATES"_L1;
94 if (!metaData.exists())
95 return "a broken symlink";
98 if (metaData.isLink())
99 description =
"a symbolic link to ";
101 if (metaData.isFile())
102 description +=
"a regular file";
103 else if (metaData.isDirectory())
104 description +=
"a directory";
105 else if (metaData.isSequential())
106 description +=
"a character device, socket or FIFO";
108 description +=
"a block device";
129 if (QT_MKDIR(
entry.nativeFilePath(), 0700) == 0)
131 if (errno != EEXIST) {
132 qErrnoWarning(
"QStandardPaths: error creating runtime directory '%ls'",
140 qErrnoWarning(
"QStandardPaths: error obtaining permissions of runtime directory '%ls'",
149 qWarning(
"QStandardPaths: runtime directory '%ls' is not a directory, but %s",
150 qUtf16Printable(xdgRuntimeDir), describeMetaData(metaData).constData());
155 if (metaData.
userId() != myUid) {
156 qWarning(
"QStandardPaths: runtime directory '%ls' is not owned by UID %d, but %s",
157 qUtf16Printable(xdgRuntimeDir), myUid, describeMetaData(metaData).constData());
163 qWarning(
"QStandardPaths: wrong permissions on runtime directory %ls, %s instead of %s",
189 if (!xdgCacheHome.startsWith(u
'/'))
190 xdgCacheHome.clear();
192 if (xdgCacheHome.isEmpty())
208 if (!xdgStateHome.startsWith(u
'/'))
209 xdgStateHome.clear();
211 if (xdgStateHome.isEmpty())
227 if (!xdgDataHome.startsWith(u
'/'))
230 if (xdgDataHome.isEmpty())
247 if (!xdgConfigHome.startsWith(u
'/'))
248 xdgConfigHome.clear();
250 if (xdgConfigHome.isEmpty())
255 return xdgConfigHome;
260 if (!xdgRuntimeDir.startsWith(u
'/'))
261 xdgRuntimeDir.clear();
263 bool fromEnv = !xdgRuntimeDir.isEmpty();
277 xdgRuntimeDir.clear();
280 return xdgRuntimeDir;
286#if QT_CONFIG(regularexpression)
289 if (!xdgConfigHome.startsWith(u
'/'))
290 xdgConfigHome.clear();
292 if (xdgConfigHome.isEmpty())
294 QFile file(xdgConfigHome +
"/user-dirs.dirs"_L1);
307 &&
value.startsWith(u
'\"')
308 &&
value.endsWith(u
'\"'))
311 if (
value.startsWith(
"$HOME"_L1))
385 dirs.removeDuplicates();
397 dirs =
QStringList{u
"/usr/local/share"_s, u
"/usr/share"_s};
409 dirs.push_back(u
"/etc/xdg"_s);
424 for (
int i = 0;
i < dirs.size(); ++
i)
432 for (
int i = 0;
i < dirs.size(); ++
i)
433 dirs[
i].
append(
"/applications"_L1);
438 for (
int i = 0;
i < dirs.size(); ++
i)
444 for (
int i = 1;
i < dirs.size(); ++
i)
451 dirs.prepend(localDir);
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
QString organizationName
the name of the organization that wrote this application
QString applicationName
the name of this application
static QString tempPath()
Returns the absolute canonical path of the system's temporary directory.
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
static QString homePath()
Returns the absolute path of the user's home directory.
static bool fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what)
static QString resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
static QString decodeName(const QByteArray &localFileName)
This does the reverse of QFile::encodeName() using localFileName.
\inmodule QtCore \reentrant
\inmodule QtCore \reentrant
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 startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
list append(new Employee("Blackpool", "Stephen"))
void qErrnoWarning(const char *msg,...)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLchar *const * path
static void appendOrganizationAndApp(QString &path)
static QByteArray unixPermissionsText(QFile::Permissions permissions)
static QStringList dirsList(const QString &xdgEnvVar)
static bool checkXdgRuntimeDir(const QString &xdgRuntimeDir)
static QStringList xdgConfigDirs()
static void appendOrganizationAndApp(QString &path)
static QStringList xdgDataDirs()
#define qUtf16Printable(string)
constexpr auto qTokenize(Haystack &&h, Needle &&n, Flags...flags) noexcept(QtPrivate::Tok::is_nothrow_constructible_from< Haystack, Needle >::value) -> decltype(QtPrivate::Tok::TokenizerResult< Haystack, Needle >{std::forward< Haystack >(h), std::forward< Needle >(n), flags...})
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)