MCPcopy Create free account
hub / github.com/KDE/kdevelop / cdQUrl

Function cdQUrl

kdevplatform/util/tests/test_path.cpp:584–595  ·  view source on GitHub ↗

there is no cd() in QUrl, emulate what KUrl did

Source from the content-addressed store, hash-verified

582
583// there is no cd() in QUrl, emulate what KUrl did
584static 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
597void TestPath::testPathCd()
598{

Callers 1

testPathCdMethod · 0.85

Calls 7

endsWithMethod · 0.80
resolvedMethod · 0.80
QUrlClass · 0.50
isEmptyMethod · 0.45
isValidMethod · 0.45
pathMethod · 0.45
setPathMethod · 0.45

Tested by

no test coverage detected