there is no cd() in QUrl, emulate what KUrl did
| 582 | |
| 583 | // there is no cd() in QUrl, emulate what KUrl did |
| 584 | static bool cdQUrl(QUrl& url, const QString& path) |
| 585 | { |
| 586 | if (path.isEmpty() || !url.isValid()) { |
| 587 | return false; |
| 588 | } |
| 589 | // have to append slash otherwise last segment is treated as a file name and not a directory |
| 590 | if (!url.path().endsWith('/')) { |
| 591 | url.setPath(url.path() + '/'); |
| 592 | } |
| 593 | url = url.resolved(QUrl(path)).adjusted(QUrl::RemoveFragment | QUrl::RemoveQuery); |
| 594 | return true; |
| 595 | } |
| 596 | |
| 597 | void TestPath::testPathCd() |
| 598 | { |