Commit 8255175c authored by Kåre Särs's avatar Kåre Särs
Browse files

BP: Fix CTags process starting: Enable index paths with spaces

parent 140337a6
......@@ -90,7 +90,10 @@ KateCTagsConfigPage::KateCTagsConfigPage(QWidget *parent, KateCTagsPlugin *plugi
connect(m_confUi.delButton, &QPushButton::clicked, this, &KateCTagsConfigPage::delGlobalTagTarget);
connect(&m_proc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, &KateCTagsConfigPage::updateDone);
connect(&m_proc, &QProcess::readyReadStandardError, this, [this]() {
QString error = QString::fromLocal8Bit(m_proc.readAllStandardError());
KMessageBox::sorry(nullptr, error);
});
reset();
}
......@@ -207,7 +210,7 @@ void KateCTagsConfigPage::updateGlobalDB()
if (target.endsWith(QLatin1Char('/')) || target.endsWith(QLatin1Char('\\'))) {
target = target.left(target.size() - 1);
}
targets += target + QLatin1Char(' ');
targets += QLatin1Char('\"') + target + QLatin1String("\" ");
}
QString file = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/katectags");
......@@ -220,12 +223,16 @@ void KateCTagsConfigPage::updateGlobalDB()
}
QString commandLine = QStringLiteral("%1 -f %2 %3").arg(m_confUi.cmdEdit->text(), file, targets);
QStringList arguments = commandLine.split(QLatin1Char(' '));
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QStringList arguments = m_proc.splitCommand(commandLine);
QString command = arguments.takeFirst();
m_proc.start(command, arguments);
#else
m_proc.start(commandLine);
#endif
if (!m_proc.waitForStarted(500)) {
KMessageBox::error(nullptr, i18n("Failed to run \"%1\". exitStatus = %2", command, m_proc.exitStatus()));
KMessageBox::error(nullptr, i18n("Failed to run \"%1\". exitStatus = %2", commandLine, m_proc.exitStatus()));
return;
}
m_confUi.updateDB->setDisabled(true);
......
......@@ -124,6 +124,10 @@ KateCTagsView::KateCTagsView(KTextEditor::Plugin *plugin, KTextEditor::MainWindo
connect(m_ctagsUi.updateButton, &QPushButton::clicked, this, &KateCTagsView::updateSessionDB);
connect(m_ctagsUi.updateButton2, &QPushButton::clicked, this, &KateCTagsView::updateSessionDB);
connect(&m_proc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, &KateCTagsView::updateDone);
connect(&m_proc, &QProcess::readyReadStandardError, this, [this]() {
QString error = QString::fromLocal8Bit(m_proc.readAllStandardError());
KMessageBox::sorry(nullptr, error);
});
connect(m_ctagsUi.inputEdit, &QLineEdit::textChanged, this, &KateCTagsView::startEditTmr);
......@@ -495,7 +499,7 @@ void KateCTagsView::updateSessionDB()
if (target.endsWith(QLatin1Char('/')) || target.endsWith(QLatin1Char('\\'))) {
target = target.left(target.size() - 1);
}
targets += target + QLatin1Char(' ');
targets += QLatin1Char('\"') + target + QLatin1String("\" ");
}
QString pluginFolder = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/katectags");
......@@ -515,12 +519,16 @@ void KateCTagsView::updateSessionDB()
}
QString commandLine = QStringLiteral("%1 -f %2 %3").arg(m_ctagsUi.cmdEdit->text(), m_ctagsUi.tagsFile->text(), targets);
QStringList arguments = commandLine.split(QLatin1Char(' '));
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QStringList arguments = m_proc.splitCommand(commandLine);
QString command = arguments.takeFirst();
m_proc.start(command, arguments);
#else
m_proc.start(commandLine);
#endif
if (!m_proc.waitForStarted(500)) {
KMessageBox::error(nullptr, i18n("Failed to run \"%1\". exitStatus = %2", command, m_proc.exitStatus()));
KMessageBox::error(nullptr, i18n("Failed to run \"%1\". exitStatus = %2", commandLine, m_proc.exitStatus()));
return;
}
QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment