forked from qt-creator/qt-creator
Utils: Introduce a FilePath::fromPathPart()
... as shortcut for the fromParts({}, {}, x) case. Less noise on the user side, and saves a few cycles. Change-Id: Ie5b2a76c7261a049a3e600f29c4edaff37ab3828 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -161,6 +161,14 @@ FilePath FilePath::fromParts(const QStringView scheme, const QStringView host, c
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath FilePath::fromPathPart(const QStringView path)
|
||||||
|
{
|
||||||
|
FilePath result;
|
||||||
|
result.m_data = path.toString();
|
||||||
|
result.m_pathLen = path.size();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
FilePath FilePath::currentWorkingPath()
|
FilePath FilePath::currentWorkingPath()
|
||||||
{
|
{
|
||||||
return FilePath::fromString(QDir::currentPath());
|
return FilePath::fromString(QDir::currentPath());
|
||||||
|
@@ -64,6 +64,7 @@ public:
|
|||||||
[[nodiscard]] static FilePath fromVariant(const QVariant &variant);
|
[[nodiscard]] static FilePath fromVariant(const QVariant &variant);
|
||||||
[[nodiscard]] static FilePath fromUrl(const QUrl &url);
|
[[nodiscard]] static FilePath fromUrl(const QUrl &url);
|
||||||
[[nodiscard]] static FilePath fromParts(const QStringView scheme, const QStringView host, const QStringView path);
|
[[nodiscard]] static FilePath fromParts(const QStringView scheme, const QStringView host, const QStringView path);
|
||||||
|
[[nodiscard]] static FilePath fromPathPart(const QStringView path);
|
||||||
|
|
||||||
[[nodiscard]] static FilePath currentWorkingPath();
|
[[nodiscard]] static FilePath currentWorkingPath();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user