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

Function findSessionId

app/main.cpp:283–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283static QString findSessionId(const SessionInfos& availableSessionInfos, const QString& session)
284{
285 //If there is a session and a project with the same name, always open the session
286 //regardless of the order encountered
287 QString projectAsSession;
288 for (const KDevelop::SessionInfo& si : availableSessionInfos) {
289 if ( session == si.name || session == si.uuid.toString() ) {
290 return si.uuid.toString();
291 } else if (projectAsSession.isEmpty()) {
292 for (const QUrl& k : si.projects) {
293 QString fn(k.fileName());
294 fn = fn.left(fn.indexOf(QLatin1Char('.')));
295 if ( session == fn ) {
296 projectAsSession = si.uuid.toString();
297 }
298 }
299 }
300 }
301
302 if (projectAsSession.isEmpty()) {
303 QTextStream qerr(stderr);
304 qerr << QLatin1Char('\n') << i18n("Cannot open unknown session %1. See `--list-sessions` switch for available sessions or use `-n` to create a new one.",
305 session) << QLatin1Char('\n');
306 }
307 return projectAsSession;
308}
309
310static qint64 findSessionPid(const QString &sessionId)
311{

Callers 1

mainFunction · 0.85

Calls 4

toStringMethod · 0.45
isEmptyMethod · 0.45
fileNameMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected