Work-around issue in Path(QString) ctor

Authored by kfunk on Apr 19 2017, 9:44 AM.

Description

Work-around issue in Path(QString) ctor

Problem: Path(QString) will call Path(QUrl) constructor, constructing an
url via QUrl::fromUserInput(...).

Because QUrl::fromUserInput by default is in tolerant mode, Path("/tmp/
") would be transformed into Path(QUrl("file:///tmp")) -> thus break the
path.

Consider this example:

 #include <QDebug>
 #include <QUrl>

int main()
{
    auto u1 = QUrl::fromLocalFile("/tmp/ ");
    auto u2 = QUrl::fromUserInput("/tmp/ ");
    qDebug() << u1.toLocalFile();
    qDebug() << u2.toLocalFile();
}

Will give:

main(8): "/tmp/ "
main(9): "/tmp/"

TODO: We need another Path ctor when we are sure we want to pass a local
file (e.g. by adding a static Path::fromLocalFile(...))?

CCBUG: 378933

Details

Committed
kfunkApr 19 2017, 9:56 AM
Parents
R33:de8e04bb5d2f: helper: Add more debug output
Branches
Unknown
Tags
Unknown