forked from qt-creator/qt-creator
Utils: Add convenience functions FilePath::path{List,Component}Separator
Change-Id: Ib00aace2d5e98fa69a5a23b3950e560aefc662f6 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1420,6 +1420,24 @@ Qt::CaseSensitivity FilePath::caseSensitivity() const
|
|||||||
return Qt::CaseSensitive;
|
return Qt::CaseSensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns the separator of path components for this path.
|
||||||
|
* \returns The path separator of the path.
|
||||||
|
*/
|
||||||
|
QChar FilePath::pathComponentSeparator() const
|
||||||
|
{
|
||||||
|
return osType() == OsTypeWindows ? u'\\' : u'/';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns the path list separator for the device this path belongs to.
|
||||||
|
* \returns The path list separator of the device for this path
|
||||||
|
*/
|
||||||
|
QChar FilePath::pathListSeparator() const
|
||||||
|
{
|
||||||
|
return osType() == OsTypeWindows ? u';' : u':';
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Recursively resolves symlinks if this is a symlink.
|
* \brief Recursively resolves symlinks if this is a symlink.
|
||||||
* To resolve symlinks anywhere in the path, see canonicalPath.
|
* To resolve symlinks anywhere in the path, see canonicalPath.
|
||||||
|
@@ -140,6 +140,8 @@ public:
|
|||||||
[[nodiscard]] FilePath operator/(const QString &str) const;
|
[[nodiscard]] FilePath operator/(const QString &str) const;
|
||||||
|
|
||||||
Qt::CaseSensitivity caseSensitivity() const;
|
Qt::CaseSensitivity caseSensitivity() const;
|
||||||
|
QChar pathComponentSeparator() const;
|
||||||
|
QChar pathListSeparator() const;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
Reference in New Issue
Block a user