| 139 | } |
| 140 | |
| 141 | void FlatpakPlugin::createRuntime(const KDevelop::Path &file, const QString &arch) |
| 142 | { |
| 143 | IProject* project = ICore::self()->projectController()->findProjectForUrl(file.toUrl()); |
| 144 | const KDevelop::Path path(flatpakBuildDirPath(project, arch)); |
| 145 | if (path.isEmpty()) { |
| 146 | return; |
| 147 | } |
| 148 | |
| 149 | auto* const process = |
| 150 | FlatpakRuntime::createBuildDirectory(path, file, arch, FlatpakRuntime::CreationMode::DisableUpdates); |
| 151 | connect(process, &KJob::finished, this, [this, path, file, arch](KJob* job) { |
| 152 | if (job->error() != 0) { |
| 153 | QDir(path.toLocalFile()).removeRecursively(); |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | auto rt = new FlatpakRuntime(path, file, arch); |
| 158 | m_runtimes += rt; |
| 159 | connect(rt, &QObject::destroyed, this, [this, rt]() { |
| 160 | m_runtimes.removeAll(rt); |
| 161 | }); |
| 162 | ICore::self()->runtimeController()->addRuntimes(rt); |
| 163 | auto p = ICore::self()->projectController()->findProjectForUrl(file.toUrl()); |
| 164 | if (p) { |
| 165 | auto config = p->projectConfiguration()->group(QStringLiteral("Flatpak")); |
| 166 | config.writeEntry("File", file.toUrl()); |
| 167 | } |
| 168 | }); |
| 169 | process->start(); |
| 170 | } |
| 171 | |
| 172 | static QStringList availableArches(const QJsonObject& doc) |
| 173 | { |
nothing calls this directly
no test coverage detected