QDir/QFileInfo: add doc notes about paths starting with ':'
This is an addendum to commit 0da5726a43b; making the note about paths starting with ':' being treated as absolute paths by the underlying QFileSystemEngine, more visible, so that users of the class don't hit that pitfall. Add similar docs to QFileInfo. Change-Id: Ib34d066d31bb673d340ec41422ed4daf911765b8 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 138fa9f2f4445832769a126a8ea72686b3687933) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9e287b50ee
commit
c3b963ae4d
@ -408,6 +408,9 @@ inline void QDirPrivate::initFileEngine()
|
|||||||
a QDir is using a relative or an absolute file path. Call
|
a QDir is using a relative or an absolute file path. Call
|
||||||
makeAbsolute() to convert a relative QDir to an absolute one.
|
makeAbsolute() to convert a relative QDir to an absolute one.
|
||||||
|
|
||||||
|
\note Paths starting with a colon (\e{:}) are always considered
|
||||||
|
absolute, as they denote a QResource.
|
||||||
|
|
||||||
\section1 Navigation and Directory Operations
|
\section1 Navigation and Directory Operations
|
||||||
|
|
||||||
A directory's path can be obtained with the path() function, and
|
A directory's path can be obtained with the path() function, and
|
||||||
@ -1689,6 +1692,9 @@ bool QDir::isRoot() const
|
|||||||
Returns \c true if the directory's path is absolute; otherwise
|
Returns \c true if the directory's path is absolute; otherwise
|
||||||
returns \c false. See isAbsolutePath().
|
returns \c false. See isAbsolutePath().
|
||||||
|
|
||||||
|
\note Paths starting with a colon (\e{:}) are always considered
|
||||||
|
absolute, as they denote a QResource.
|
||||||
|
|
||||||
\sa isRelative(), makeAbsolute(), cleanPath()
|
\sa isRelative(), makeAbsolute(), cleanPath()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1698,9 +1704,8 @@ bool QDir::isRoot() const
|
|||||||
Returns \c true if \a path is absolute; returns \c false if it is
|
Returns \c true if \a path is absolute; returns \c false if it is
|
||||||
relative.
|
relative.
|
||||||
|
|
||||||
\note If \a path starts with ':', this function will return \c true
|
\note Paths starting with a colon (\e{:}) are always considered
|
||||||
because paths starting with ':' are treated specially as they denote
|
absolute, as they denote a QResource.
|
||||||
a QResource.
|
|
||||||
|
|
||||||
\sa isAbsolute(), isRelativePath(), makeAbsolute(), cleanPath(), QResource
|
\sa isAbsolute(), isRelativePath(), makeAbsolute(), cleanPath(), QResource
|
||||||
*/
|
*/
|
||||||
@ -1710,6 +1715,9 @@ bool QDir::isRoot() const
|
|||||||
false. (Under Unix a path is relative if it does not start with a
|
false. (Under Unix a path is relative if it does not start with a
|
||||||
"/").
|
"/").
|
||||||
|
|
||||||
|
\note Paths starting with a colon (\e{:}) are always considered
|
||||||
|
absolute, as they denote a QResource.
|
||||||
|
|
||||||
\sa makeAbsolute(), isAbsolute(), isAbsolutePath(), cleanPath()
|
\sa makeAbsolute(), isAbsolute(), isAbsolutePath(), cleanPath()
|
||||||
*/
|
*/
|
||||||
bool QDir::isRelative() const
|
bool QDir::isRelative() const
|
||||||
@ -2348,6 +2356,9 @@ QString QDir::cleanPath(const QString &path)
|
|||||||
Returns \c true if \a path is relative; returns \c false if it is
|
Returns \c true if \a path is relative; returns \c false if it is
|
||||||
absolute.
|
absolute.
|
||||||
|
|
||||||
|
\note Paths starting with a colon (\e{:}) are always considered
|
||||||
|
absolute, as they denote a QResource.
|
||||||
|
|
||||||
\sa isRelative(), isAbsolutePath(), makeAbsolute()
|
\sa isRelative(), isAbsolutePath(), makeAbsolute()
|
||||||
*/
|
*/
|
||||||
bool QDir::isRelativePath(const QString &path)
|
bool QDir::isRelativePath(const QString &path)
|
||||||
|
@ -241,6 +241,9 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
|
|||||||
path. You can call the function makeAbsolute() to convert a
|
path. You can call the function makeAbsolute() to convert a
|
||||||
relative QFileInfo's path to an absolute path.
|
relative QFileInfo's path to an absolute path.
|
||||||
|
|
||||||
|
\note Paths starting with a colon (\e{:}) are always considered
|
||||||
|
absolute, as they denote a QResource.
|
||||||
|
|
||||||
The file that the QFileInfo works on is set in the constructor or
|
The file that the QFileInfo works on is set in the constructor or
|
||||||
later with setFile(). Use exists() to see if the file exists and
|
later with setFile(). Use exists() to see if the file exists and
|
||||||
size() to get its size.
|
size() to get its size.
|
||||||
@ -634,17 +637,23 @@ QString QFileInfo::path() const
|
|||||||
/*!
|
/*!
|
||||||
\fn bool QFileInfo::isAbsolute() const
|
\fn bool QFileInfo::isAbsolute() const
|
||||||
|
|
||||||
Returns \c true if the file path name is absolute, otherwise returns
|
Returns \c true if the file path is absolute, otherwise returns \c false (i.e.
|
||||||
false if the path is relative.
|
the path is relative).
|
||||||
|
|
||||||
|
\note Paths starting with a colon (\e{:}) are always considered absolute, as
|
||||||
|
they denote a QResource.
|
||||||
|
|
||||||
\sa isRelative()
|
\sa isRelative()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns \c true if the file path name is relative, otherwise returns
|
Returns \c true if the file path is relative, otherwise returns \c
|
||||||
false if the path is absolute (e.g. under Unix a path is absolute
|
false (i.e. the path is absolute). (E.g. under Unix a path is absolute
|
||||||
if it begins with a "/").
|
if it begins with a "/").
|
||||||
|
|
||||||
|
\note Paths starting with a colon (\e{:}) are always considered absolute,
|
||||||
|
as they denote a QResource.
|
||||||
|
|
||||||
\sa isAbsolute()
|
\sa isAbsolute()
|
||||||
*/
|
*/
|
||||||
bool QFileInfo::isRelative() const
|
bool QFileInfo::isRelative() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user