forked from qt-creator/qt-creator
Utils: Clean path in FilePath::resolvePath
Change-Id: I27e34e21c2922db4d7598c77688133aebf6ce893 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -1263,9 +1263,8 @@ FilePath FilePath::pathAppended(const QString &path) const
|
||||
|
||||
FilePath other = FilePath::fromString(path);
|
||||
|
||||
if (isEmpty()) {
|
||||
if (isEmpty())
|
||||
return other;
|
||||
}
|
||||
|
||||
QString p = this->path();
|
||||
join(p, other.path());
|
||||
@@ -1549,7 +1548,7 @@ bool FilePath::isRelativePath() const
|
||||
FilePath FilePath::resolvePath(const FilePath &tail) const
|
||||
{
|
||||
if (tail.isRelativePath())
|
||||
return pathAppended(tail.path());
|
||||
return pathAppended(tail.path()).cleanPath();
|
||||
return tail;
|
||||
}
|
||||
|
||||
|
@@ -84,8 +84,10 @@ private slots:
|
||||
|
||||
void bytesAvailableFromDF_data();
|
||||
void bytesAvailableFromDF();
|
||||
|
||||
void rootLength_data();
|
||||
void rootLength();
|
||||
|
||||
void schemeAndHostLength_data();
|
||||
void schemeAndHostLength();
|
||||
|
||||
@@ -852,6 +854,8 @@ void tst_fileutils::resolvePath_data()
|
||||
QTest::newRow("s4") << FilePath("/a") << FilePath("/b") << FilePath("/b");
|
||||
QTest::newRow("s5") << FilePath("a") << FilePath("/b") << FilePath("/b");
|
||||
QTest::newRow("s6") << FilePath("/a") << FilePath("b") << FilePath("/a/b");
|
||||
QTest::newRow("s7") << FilePath("/a") << FilePath(".") << FilePath("/a");
|
||||
QTest::newRow("s8") << FilePath("/a") << FilePath("./b") << FilePath("/a/b");
|
||||
}
|
||||
|
||||
void tst_fileutils::resolvePath()
|
||||
|
Reference in New Issue
Block a user