| 204 | } |
| 205 | |
| 206 | KDevelop::Path DockerRuntime::pathInRuntime(const KDevelop::Path& localPath) const |
| 207 | { |
| 208 | if (m_userMergedDir==localPath || m_userMergedDir.isParentOf(localPath)) { |
| 209 | KDevelop::Path ret(KDevelop::Path(QStringLiteral("/")), m_userMergedDir.relativePath(localPath)); |
| 210 | qCDebug(DOCKER) << "docker runtime pathInRuntime..." << ret << localPath; |
| 211 | return ret; |
| 212 | } else if (auto project = ICore::self()->projectController()->findProjectForUrl(localPath.toUrl())) { |
| 213 | const Path projectsDir(DockerRuntime::s_settings->projectsVolume()); |
| 214 | const QString relpath = project->path().relativePath(localPath); |
| 215 | const KDevelop::Path ret(projectsDir, project->name() + QLatin1Char('/') + relpath); |
| 216 | qCDebug(DOCKER) << "docker user pathInRuntime..." << ret << localPath; |
| 217 | return ret; |
| 218 | } else { |
| 219 | const auto projects = ICore::self()->projectController()->projects(); |
| 220 | for (auto project : projects) { |
| 221 | auto ibsm = project->buildSystemManager(); |
| 222 | if (ibsm) { |
| 223 | const auto builddir = ibsm->buildDirectory(project->projectItem()); |
| 224 | if (builddir != localPath && !builddir.isParentOf(localPath)) |
| 225 | continue; |
| 226 | |
| 227 | const Path builddirs(DockerRuntime::s_settings->buildDirsVolume()); |
| 228 | const QString relpath = builddir.relativePath(localPath); |
| 229 | const KDevelop::Path ret(builddirs, project->name() + QLatin1Char('/') + relpath); |
| 230 | qCDebug(DOCKER) << "docker build pathInRuntime..." << ret << localPath; |
| 231 | return ret; |
| 232 | } |
| 233 | } |
| 234 | qCWarning(DOCKER) << "only project files are accessible on the docker runtime" << localPath; |
| 235 | } |
| 236 | qCDebug(DOCKER) << "bypass..." << localPath; |
| 237 | return localPath; |
| 238 | } |
| 239 | |
| 240 | QString DockerRuntime::findExecutable(const QString& executableName) const |
| 241 | { |