diff --git a/gitplusplus.cpp b/gitplusplus.cpp index 8f42d67..ac6e054 100644 --- a/gitplusplus.cpp +++ b/gitplusplus.cpp @@ -2282,6 +2282,27 @@ void GitPlusPlusView::detectWorkspace() m_workspaceRepos = workspaceRepoPaths(); } + // Auto-generate .kateworkspace if missing + wsFile = m_workspaceDir + QStringLiteral("/.kateworkspace"); + if (!QFileInfo::exists(wsFile)) { + QSettings ws(wsFile, QSettings::IniFormat); + ws.beginGroup(QStringLiteral("workspace")); + ws.setValue(QStringLiteral("source"), QStringLiteral(".")); + ws.endGroup(); + ws.sync(); + } + + // Auto-generate .kateproject if missing + QString kateProjectFile = m_workspaceDir + QStringLiteral("/.kateproject"); + if (!QFileInfo::exists(kateProjectFile)) { + QFile kp(kateProjectFile); + if (kp.open(QIODevice::WriteOnly | QIODevice::Text)) { + QString wsName = QFileInfo(m_workspaceDir).fileName(); + kp.write("{\n \"name\": \"" + wsName.toUtf8() + "\",\n \"files\": [ { \"git\": true } ]\n}\n"); + kp.close(); + } + } + // Populate repo combo m_repoCombo->blockSignals(true); m_repoCombo->clear();