Utils: Remove internal /./ relative path marker

Some creeped into settings earlier, making the paths that were
meant to be empty look non-empty.

Also add a test for FilePath::isEmpty().

Change-Id: I99e3dd673294206558f9fee9b7c7874d2441327e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2022-11-15 16:22:49 +01:00
parent 169f2c4af6
commit ef658663aa
2 changed files with 31 additions and 3 deletions

View File

@@ -343,15 +343,17 @@ QStringView FilePath::host() const
QString FilePath::path() const
{
if (m_data.startsWith("/./"))
return m_data.mid(3, m_pathLen - 3);
QTC_ASSERT(!m_data.startsWith(u"/./"), return m_data.mid(3, m_pathLen - 3));
return m_data.left(m_pathLen);
}
void FilePath::setParts(const QStringView scheme, const QStringView host, const QStringView path)
void FilePath::setParts(const QStringView scheme, const QStringView host, QStringView path)
{
QTC_CHECK(!scheme.contains('/'));
if (path.startsWith(u"/./"))
path = path.mid(3);
m_data = path.toString() + scheme.toString() + host.toString();
m_schemeLen = scheme.size();
m_hostLen = host.size();