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

Function resolvedToLocalFile

kdevplatform/shell/ktexteditorpluginintegration.cpp:59–66  ·  view source on GitHub ↗

* If a given URL is relative, return a version of the URL resolved * to the local file scheme; otherwise return a copy of the URL. * * KTextEditor (plugins) can look up or open a document by a relative URL. * DocumentController asserts that a URL passed to it is not relative. This function * assumes that a relative URL points to a local file and works around the assertion failures. * * @pre

Source from the content-addressed store, hash-verified

57 * @pre @p !url.isEmpty() because an empty URL is special and should be handled separately by the callers
58 */
59[[nodiscard]] QUrl resolvedToLocalFile(QUrl url)
60{
61 Q_ASSERT(!url.isEmpty());
62 if (url.isRelative()) {
63 url.setScheme(QStringLiteral("file"));
64 }
65 return url;
66}
67
68/**
69 * @return whether a given URL can possibly point to a file

Callers 2

openUrlMethod · 0.85
findUrlMethod · 0.85

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected