![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include "qfilesystementry_p.h"
#include "qfilesystemmetadata_p.h"
#include <QtCore/qmutex.h>
#include <memory>
Go to the source code of this file.
Classes | |
class | QDirPrivate |
struct | QDirPrivate::FileCache |
Functions | |
Q_AUTOTEST_EXPORT bool | qt_normalizePathSegments (QString *path, QDirPrivate::PathNormalizations flags) |
Q_AUTOTEST_EXPORT bool qt_normalizePathSegments | ( | QString * | path, |
QDirPrivate::PathNormalizations | flags ) |
Updates path with redundant directory separators removed, and "."s and ".."s resolved (as far as possible). It returns false
if there were ".." segments left over, attempt to go up past the root (only applies to absolute paths), or true
otherwise.
This method is shared with QUrl, so it doesn't deal with QDir::separator(), nor does it remove the trailing slash, if any.
When dealing with URLs, we are following the "Remove dot segments" algorithm from https://www.ietf.org/rfc/rfc3986.html#section-5.2.4 URL mode differs from local path mode in these ways: 1) it can set *path to empty ("." becomes "") 2) directory path outputs end in / ("a/.." becomes "a/" instead of "a") 3) a sequence of "//" is treated as multiple path levels ("a/b//.." becomes "a/b/" and "a/b//../.." becomes "a/"), which matches the behavior observed in web browsers.
As a Qt extension, for local URLs we treat multiple slashes as one slash.
Definition at line 2240 of file qdir.cpp.
References QDirPrivate::RemotePath.