forked from qt-creator/qt-creator
FilePath: Fix parsing of qrc paths
Change-Id: I50d404bafb8d1cb4f0663cd424e1034ae26bb903 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -821,8 +821,13 @@ void FilePath::setRootAndPath(QStringView path, OsType osType)
|
|||||||
m_root = "/";
|
m_root = "/";
|
||||||
m_path = path.mid(1).toString();
|
m_path = path.mid(1).toString();
|
||||||
} else if (path.startsWith(':')) {
|
} else if (path.startsWith(':')) {
|
||||||
|
if (path.length() > 1 && path[1] == '/') {
|
||||||
m_root = ":/";
|
m_root = ":/";
|
||||||
m_path = path.mid(2).toString();
|
m_path = path.mid(2).toString();
|
||||||
|
} else {
|
||||||
|
m_root = ":";
|
||||||
|
m_path = path.mid(1).toString();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_root.clear();
|
m_root.clear();
|
||||||
m_path = path.toString();
|
m_path = path.toString();
|
||||||
|
@@ -350,6 +350,10 @@ void tst_fileutils::fromString_data()
|
|||||||
QTest::addColumn<OsType>("osType");
|
QTest::addColumn<OsType>("osType");
|
||||||
|
|
||||||
QTest::newRow("empty") << "" << "" << "" << "" << HostOsInfo::hostOs();
|
QTest::newRow("empty") << "" << "" << "" << "" << HostOsInfo::hostOs();
|
||||||
|
QTest::newRow("single-slash") << ":" << "" << "" << ":" << HostOsInfo::hostOs();
|
||||||
|
QTest::newRow("single-colon") << "/" << "" << "" << "/" << HostOsInfo::hostOs();
|
||||||
|
QTest::newRow("single-char") << "a" << "" << "" << "a" << HostOsInfo::hostOs();
|
||||||
|
QTest::newRow("qrc-no-slash") << ":test.txt" << "" << "" << ":test.txt" << HostOsInfo::hostOs();
|
||||||
QTest::newRow("qrc") << ":/test.txt" << "" << "" << ":/test.txt" << HostOsInfo::hostOs();
|
QTest::newRow("qrc") << ":/test.txt" << "" << "" << ":/test.txt" << HostOsInfo::hostOs();
|
||||||
QTest::newRow("unc-incomplete") << "//" << "" << "" << "" << OsType::OsTypeWindows;
|
QTest::newRow("unc-incomplete") << "//" << "" << "" << "" << OsType::OsTypeWindows;
|
||||||
QTest::newRow("unc-incomplete-only-server") << "//server" << "" << "" << "//server/" << OsType::OsTypeWindows;
|
QTest::newRow("unc-incomplete-only-server") << "//server" << "" << "" << "//server/" << OsType::OsTypeWindows;
|
||||||
|
Reference in New Issue
Block a user