MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / packageInstallPath

Function packageInstallPath

src/tools/languageadapter/main.cpp:16–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include <iostream>
15
16static QString packageInstallPath(const QString &python)
17{
18 auto getVersion = [](const QString &output) -> QString {
19 static QRegularExpression regex(R"((\d{1,3}(?:\.\d{1,3}){0,2}))");
20 if (output.isEmpty())
21 return "";
22
23 QRegularExpressionMatch match = regex.match(output);
24 if (match.hasMatch())
25 return match.captured(1);
26
27 return "";
28 };
29
30 QProcess process;
31 process.start(python, { "--version" });
32 process.waitForFinished();
33
34 QString output = process.readAllStandardOutput();
35 QString version = getVersion(output);
36 if (version.isEmpty()) {
37 output = process.readAllStandardError();
38 version = getVersion(output);
39 if (version.isEmpty()) {
40 int index = python.lastIndexOf('/') + 1;
41 output = python.mid(index, python.length() - index);
42 version = getVersion(output);
43 }
44 }
45 return QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
46 + "/.unioncode/packages/Python" + version;
47}
48
49// setting from clangd trismit
50QProcess *createCxxServ(const newlsp::ProjectKey &key)

Callers 3

createPythonServFunction · 0.70
checkInstalledMethod · 0.50
installMethod · 0.50

Calls 6

readAllStandardOutputMethod · 0.80
readAllStandardErrorMethod · 0.80
isEmptyMethod · 0.45
matchMethod · 0.45
startMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected