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

Method initContainer

src/plugins/container/container.cpp:79–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79ContainerError Container::initContainer(const QString &projectPath)
80{
81 qInfo() << __FUNCTION__;
82 ContainerError error;
83 QFileInfo projectFileInfo(projectPath);
84 QFileInfo projectDirInfo(projectFileInfo.filePath());
85 QString projectDirName = projectDirInfo.fileName();
86
87 auto tabWidget = ContainerKeeper::instance()->tabWidget();
88 if (tabWidget) {
89 virtualConsole = new VirtualConsole();
90 tabWidget->insertTab(0, virtualConsole, projectDirName);
91 tabWidget->setTabToolTip(0, projectPath);
92 }
93
94 auto platformPath = CustomPaths::user(CustomPaths::Flags::Configures) + QDir::separator() + QString{"platform"};
95 auto amd64PlatformPath = platformPath + QDir::separator() + QString{"amd64"};
96 auto arm64PlatformPath = platformPath + QDir::separator() + QString{"arm64"};
97 auto mips64PlatformPath = platformPath + QDir::separator() + QString{"mips64"};
98 auto amd64PlatformDir = QDir(amd64PlatformPath);
99 if (amd64PlatformDir.mkpath(amd64PlatformPath)) {
100 qInfo() << "make path $HOME/.config/unioncode/configures/platform/amd64 failed!";
101 }
102 auto arm64PlatformDir = QDir(arm64PlatformPath);
103 if (arm64PlatformDir.mkpath(arm64PlatformPath)) {
104 qInfo() << "make path $HOME/.config/unioncode/configures/platform/arm64 failed!";
105 }
106 auto mips64PlatformDir = QDir(mips64PlatformPath);
107 if (mips64PlatformDir.mkpath(mips64PlatformPath)) {
108 qInfo() << "make path $HOME/.config/unioncode/configures/platform/mips64 failed!";
109 }
110
111 // query container id by project path
112 containerId = pathUuidMap.find(projectPath).value().split(" ").last().remove("\n");
113
114 QDir::setCurrent(amd64PlatformPath);
115 auto currentPath = QDir::currentPath();
116
117 scriptsPath = CustomPaths::global(CustomPaths::Flags::Scripts);
118 auto projectRootPath = QFileInfo(projectPath).path();
119 auto containerUp = scriptsPath + QDir::separator() + QString{"container-up.sh"} + " " + QString{"amd64"} + " " + containerId + " " + projectRootPath + "\n";
120 qInfo() << containerUp;
121 if (virtualConsole) {
122 virtualConsole->sendText(containerUp);
123 virtualConsole->sendText("apt update\n");
124 }
125
126 return error;
127}
128
129ContainerError Container::stopContainer(const QString &projectPath)
130{

Callers

nothing calls this directly

Calls 9

fileNameMethod · 0.80
insertTabMethod · 0.80
filePathMethod · 0.45
tabWidgetMethod · 0.45
removeMethod · 0.45
valueMethod · 0.45
findMethod · 0.45
pathMethod · 0.45
sendTextMethod · 0.45

Tested by

no test coverage detected