Skip to content
Commit 080ed286 authored by Kevin Funk's avatar Kevin Funk
Browse files

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
parent de8e04bb
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment